File tree 4 files changed +19
-0
lines changed
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> {
298
298
redirectTo: widget.redirectTo,
299
299
);
300
300
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
+ });
301
307
} on AuthException catch (error) {
302
308
widget.onError? .call (error);
303
309
} catch (error) {
304
310
widget.onError? .call (error);
311
+ } finally {
312
+ if (mounted) {
313
+ setState (() {
314
+ _isLoading = false ;
315
+ });
316
+ }
305
317
}
306
318
},
307
319
child: Text (localization.sendPasswordReset),
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ class _SupaResetPasswordState extends State<SupaResetPassword> {
78
78
),
79
79
);
80
80
widget.onSuccess.call (response);
81
+ // FIX use_build_context_synchronously
82
+ if (! context.mounted) return ;
83
+ context.showSnackBar (localization.passwordResetSent);
81
84
} on AuthException catch (error) {
82
85
if (widget.onError == null && context.mounted) {
83
86
context.showErrorSnackBar (error.message);
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class SupaEmailAuthLocalization {
9
9
final String dontHaveAccount;
10
10
final String haveAccount;
11
11
final String sendPasswordReset;
12
+ final String passwordResetSent;
12
13
final String backToSignIn;
13
14
final String unexpectedError;
14
15
@@ -24,6 +25,7 @@ class SupaEmailAuthLocalization {
24
25
this .dontHaveAccount = 'Don\' t have an account? Sign up' ,
25
26
this .haveAccount = 'Already have an account? Sign in' ,
26
27
this .sendPasswordReset = 'Send password reset email' ,
28
+ this .passwordResetSent = 'Password reset email has been sent' ,
27
29
this .backToSignIn = 'Back to sign in' ,
28
30
this .unexpectedError = 'An unexpected error occurred' ,
29
31
});
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ class SupaResetPasswordLocalization {
3
3
final String passwordLengthError;
4
4
final String updatePassword;
5
5
final String unexpectedError;
6
+ final String passwordResetSent;
6
7
7
8
const SupaResetPasswordLocalization ({
8
9
this .enterPassword = 'Enter your password' ,
9
10
this .passwordLengthError =
10
11
'Please enter a password that is at least 6 characters long' ,
11
12
this .updatePassword = 'Update Password' ,
12
13
this .unexpectedError = 'An unexpected error occurred' ,
14
+ this .passwordResetSent = 'Password reset email has been sent' ,
13
15
});
14
16
}
You can’t perform that action at this time.
0 commit comments