Skip to content

Commit 2570961

Browse files
committed
add a dedicated redirect url parameter for a password reset flow
1 parent d7538f4 commit 2570961

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/src/components/supa_email_auth.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class SupaEmailAuth extends StatefulWidget {
5757
/// confirmation link after signing up.
5858
final String? redirectTo;
5959

60+
/// The URL to redirect the user to when clicking on the link on the
61+
/// confirmation link from a reset password confirm email.
62+
final String? redirectToResetPwd;
63+
6064
/// Callback for the user to complete a sign in.
6165
final void Function(AuthResponse response) onSignInComplete;
6266

@@ -87,6 +91,7 @@ class SupaEmailAuth extends StatefulWidget {
8791
const SupaEmailAuth({
8892
Key? key,
8993
this.redirectTo,
94+
this.redirectToResetPwd,
9095
required this.onSignInComplete,
9196
required this.onSignUpComplete,
9297
this.onPasswordResetEmailSent,
@@ -295,7 +300,7 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
295300
final email = _emailController.text.trim();
296301
await supabase.auth.resetPasswordForEmail(
297302
email,
298-
redirectTo: widget.redirectTo,
303+
redirectTo: widget.redirectToResetPwd,
299304
);
300305
widget.onPasswordResetEmailSent?.call();
301306
// FIX use_build_context_synchronously

0 commit comments

Comments
 (0)