passwor reset, bild hochladen
parent
9d5ddbb0ab
commit
51ebeea554
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
|
@ -1,48 +1,114 @@
|
|||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
class ForgetPasswort extends StatefulWidget {
|
||||
@override
|
||||
State<ForgetPasswort> createState() => _ForgetPasswortState();
|
||||
}
|
||||
import '../login_page/login_screen.dart';
|
||||
import '../services/global_variables.dart';
|
||||
|
||||
class _ForgetPasswortState extends State<ForgetPasswort> {
|
||||
class ForgetPasswort extends StatelessWidget {
|
||||
final TextEditingController _emailController = TextEditingController();
|
||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||
|
||||
ForgetPasswort({Key? key}) : super(key: key);
|
||||
|
||||
void _forgetPassSubmitForm(BuildContext context) async {
|
||||
try {
|
||||
await _auth.sendPasswordResetEmail(
|
||||
email: _emailController.text,
|
||||
);
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => Login()),
|
||||
);
|
||||
} catch (error) {
|
||||
Fluttertoast.showToast(msg: error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Passwort vergessen'),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Text(
|
||||
'Geben Sie Ihre E-Mail-Adresse ein, um das Passwort zurückzusetzen:',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-Mail-Adresse',
|
||||
border: OutlineInputBorder(),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: size.height - 18, // Adjust for bottom overflow
|
||||
child: Stack(
|
||||
children: [
|
||||
Image.network(
|
||||
signupUrlImage,
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final email = _emailController.text;
|
||||
// Fügen Sie hier den Code für das Zurücksetzen des Passworts hinzu
|
||||
},
|
||||
child: const Text('Passwort zurücksetzen'),
|
||||
),
|
||||
],
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 80),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 80, right: 80),
|
||||
child: Transform.scale(
|
||||
scale: 0.8, // 20% smaller
|
||||
child: Image.asset('assets/images/password.png'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const Text(
|
||||
'Geben Sie Ihre E-Mail-Adresse ein, um das Passwort zurückzusetzen:',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
style: TextStyle(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-Mail',
|
||||
filled: true,
|
||||
fillColor: Colors.blueGrey.withOpacity(0.2),
|
||||
errorBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Bitte geben Sie Ihre E-Mail-Adresse ein';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_forgetPassSubmitForm(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.cyan,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 14),
|
||||
child: Text(
|
||||
'Reset Passwort',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cpd_ss23/ForgetPasswort/forget_pass_screen.dart';
|
||||
import 'package:cpd_ss23/forget_passwort/forget_pass_screen.dart';
|
||||
import 'package:cpd_ss23/services/global_methods.dart';
|
||||
import 'package:cpd_ss23/services/global_variables.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../forget_passwort/forget_pass_screen.dart';
|
||||
import '../signup_page/signup_screen.dart';
|
||||
|
||||
class Login extends StatefulWidget {
|
||||
|
|
|
@ -109,7 +109,7 @@ class _SignUpState extends State<SignUp> {
|
|||
'createdAt': Timestamp.now(),
|
||||
|
||||
});
|
||||
Navigator.canPop(context) ? Navigator.of(context) : null;
|
||||
Navigator.canPop(context) ? Navigator.pop(context) : null;
|
||||
} catch (e) {
|
||||
// Handle any errors that occur during sign-up
|
||||
setState(){
|
||||
|
@ -117,7 +117,6 @@ class _SignUpState extends State<SignUp> {
|
|||
}
|
||||
GlobalMethod.showErrorDialog(error: e.toString(), ctx: context);
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue