passwor reset, bild hochladen
parent
9d5ddbb0ab
commit
51ebeea554
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
|
@ -1,24 +1,61 @@
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
|
||||||
class ForgetPasswort extends StatefulWidget {
|
import '../login_page/login_screen.dart';
|
||||||
@override
|
import '../services/global_variables.dart';
|
||||||
State<ForgetPasswort> createState() => _ForgetPasswortState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ForgetPasswortState extends State<ForgetPasswort> {
|
class ForgetPasswort extends StatelessWidget {
|
||||||
final TextEditingController _emailController = TextEditingController();
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
body: SingleChildScrollView(
|
||||||
title: const Text('Passwort vergessen'),
|
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,
|
||||||
),
|
),
|
||||||
body: Padding(
|
Center(
|
||||||
padding: const EdgeInsets.all(16.0),
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 80),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
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(
|
const Text(
|
||||||
'Geben Sie Ihre E-Mail-Adresse ein, um das Passwort zurückzusetzen:',
|
'Geben Sie Ihre E-Mail-Adresse ein, um das Passwort zurückzusetzen:',
|
||||||
style: TextStyle(fontSize: 16),
|
style: TextStyle(fontSize: 16),
|
||||||
|
@ -26,23 +63,52 @@ class _ForgetPasswortState extends State<ForgetPasswort> {
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
keyboardType: TextInputType.emailAddress,
|
style: TextStyle(color: Colors.white),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'E-Mail-Adresse',
|
labelText: 'E-Mail',
|
||||||
border: OutlineInputBorder(),
|
filled: true,
|
||||||
|
fillColor: Colors.blueGrey.withOpacity(0.2),
|
||||||
|
errorBorder: const UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.red),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Bitte geben Sie Ihre E-Mail-Adresse ein';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final email = _emailController.text;
|
_forgetPassSubmitForm(context);
|
||||||
// Fügen Sie hier den Code für das Zurücksetzen des Passworts hinzu
|
|
||||||
},
|
},
|
||||||
child: const Text('Passwort zurücksetzen'),
|
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: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_methods.dart';
|
||||||
import 'package:cpd_ss23/services/global_variables.dart';
|
import 'package:cpd_ss23/services/global_variables.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../forget_passwort/forget_pass_screen.dart';
|
||||||
import '../signup_page/signup_screen.dart';
|
import '../signup_page/signup_screen.dart';
|
||||||
|
|
||||||
class Login extends StatefulWidget {
|
class Login extends StatefulWidget {
|
||||||
|
|
|
@ -109,7 +109,7 @@ class _SignUpState extends State<SignUp> {
|
||||||
'createdAt': Timestamp.now(),
|
'createdAt': Timestamp.now(),
|
||||||
|
|
||||||
});
|
});
|
||||||
Navigator.canPop(context) ? Navigator.of(context) : null;
|
Navigator.canPop(context) ? Navigator.pop(context) : null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Handle any errors that occur during sign-up
|
// Handle any errors that occur during sign-up
|
||||||
setState(){
|
setState(){
|
||||||
|
@ -117,7 +117,6 @@ class _SignUpState extends State<SignUp> {
|
||||||
}
|
}
|
||||||
GlobalMethod.showErrorDialog(error: e.toString(), ctx: context);
|
GlobalMethod.showErrorDialog(error: e.toString(), ctx: context);
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue