Skip to content

Commit 984db75

Browse files
committed
feat: Allow password recovery email to be redirected to other URL
1 parent d8ef470 commit 984db75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/src/components/supa_email_auth.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ 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+
/// password recovery link.
62+
///
63+
/// If unspecified, the [redirectTo] value will be used.
64+
final String? resetPasswordRedirectTo;
65+
6066
/// Callback for the user to complete a sign in.
6167
final void Function(AuthResponse response) onSignInComplete;
6268

@@ -87,6 +93,7 @@ class SupaEmailAuth extends StatefulWidget {
8793
const SupaEmailAuth({
8894
super.key,
8995
this.redirectTo,
96+
this.resetPasswordRedirectTo,
9097
required this.onSignInComplete,
9198
required this.onSignUpComplete,
9299
this.onPasswordResetEmailSent,
@@ -295,7 +302,8 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
295302
final email = _emailController.text.trim();
296303
await supabase.auth.resetPasswordForEmail(
297304
email,
298-
redirectTo: widget.redirectTo,
305+
redirectTo:
306+
widget.resetPasswordRedirectTo ?? widget.redirectTo,
299307
);
300308
widget.onPasswordResetEmailSent?.call();
301309
// FIX use_build_context_synchronously

0 commit comments

Comments
 (0)