File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -298,10 +298,22 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
298298 redirectTo: widget.redirectTo,
299299 );
300300 widget.onPasswordResetEmailSent? .call ();
301+ // FIX use_build_context_synchronously
302+ if (! context.mounted) return ;
303+ context.showSnackBar (localization.passwordResetSent);
304+ setState (() {
305+ _forgotPassword = false ;
306+ });
301307 } on AuthException catch (error) {
302308 widget.onError? .call (error);
303309 } catch (error) {
304310 widget.onError? .call (error);
311+ } finally {
312+ if (mounted) {
313+ setState (() {
314+ _isLoading = false ;
315+ });
316+ }
305317 }
306318 },
307319 child: Text (localization.sendPasswordReset),
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ class _SupaResetPasswordState extends State<SupaResetPassword> {
7878 ),
7979 );
8080 widget.onSuccess.call (response);
81+ // FIX use_build_context_synchronously
82+ if (! context.mounted) return ;
83+ context.showSnackBar (localization.passwordResetSent);
8184 } on AuthException catch (error) {
8285 if (widget.onError == null && context.mounted) {
8386 context.showErrorSnackBar (error.message);
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class SupaEmailAuthLocalization {
99 final String dontHaveAccount;
1010 final String haveAccount;
1111 final String sendPasswordReset;
12+ final String passwordResetSent;
1213 final String backToSignIn;
1314 final String unexpectedError;
1415
@@ -24,6 +25,7 @@ class SupaEmailAuthLocalization {
2425 this .dontHaveAccount = 'Don\' t have an account? Sign up' ,
2526 this .haveAccount = 'Already have an account? Sign in' ,
2627 this .sendPasswordReset = 'Send password reset email' ,
28+ this .passwordResetSent = 'Password reset email has been sent' ,
2729 this .backToSignIn = 'Back to sign in' ,
2830 this .unexpectedError = 'An unexpected error occurred' ,
2931 });
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ class SupaResetPasswordLocalization {
33 final String passwordLengthError;
44 final String updatePassword;
55 final String unexpectedError;
6+ final String passwordResetSent;
67
78 const SupaResetPasswordLocalization ({
89 this .enterPassword = 'Enter your password' ,
910 this .passwordLengthError =
1011 'Please enter a password that is at least 6 characters long' ,
1112 this .updatePassword = 'Update Password' ,
1213 this .unexpectedError = 'An unexpected error occurred' ,
14+ this .passwordResetSent = 'Password reset email has been sent' ,
1315 });
1416}
You can’t perform that action at this time.
0 commit comments