Add OTP sign-in option + Account Linking (#276)
* feat(accounts): allow linking email password * feat(auth): add OTP sign-in * refactor(accounts): remove 'sonner' dependency and update toast imports * feat(supabase): enable analytics and configure database seeding * feat(auth): update email templates and add OTP template * feat(auth): add last sign in method hints * feat(config): add devIndicators position to bottom-right * feat(auth): implement comprehensive last authentication method tracking tests
This commit is contained in:
committed by
GitHub
parent
856e9612c4
commit
9033155fcd
@@ -7,6 +7,7 @@ import type { z } from 'zod';
|
||||
import { useSignInWithEmailPassword } from '@kit/supabase/hooks/use-sign-in-with-email-password';
|
||||
|
||||
import { useCaptchaToken } from '../captcha/client';
|
||||
import { useLastAuthMethod } from '../hooks/use-last-auth-method';
|
||||
import type { PasswordSignInSchema } from '../schemas/password-sign-in.schema';
|
||||
import { AuthErrorAlert } from './auth-error-alert';
|
||||
import { PasswordSignInForm } from './password-sign-in-form';
|
||||
@@ -18,6 +19,7 @@ export function PasswordSignInContainer({
|
||||
}) {
|
||||
const { captchaToken, resetCaptchaToken } = useCaptchaToken();
|
||||
const signInMutation = useSignInWithEmailPassword();
|
||||
const { recordAuthMethod } = useLastAuthMethod();
|
||||
const isLoading = signInMutation.isPending;
|
||||
const isRedirecting = signInMutation.isSuccess;
|
||||
|
||||
@@ -29,6 +31,9 @@ export function PasswordSignInContainer({
|
||||
options: { captchaToken },
|
||||
});
|
||||
|
||||
// Record successful password sign-in
|
||||
recordAuthMethod('password', { email: credentials.email });
|
||||
|
||||
if (onSignIn) {
|
||||
const userId = data?.user?.id;
|
||||
|
||||
@@ -40,7 +45,13 @@ export function PasswordSignInContainer({
|
||||
resetCaptchaToken();
|
||||
}
|
||||
},
|
||||
[captchaToken, onSignIn, resetCaptchaToken, signInMutation],
|
||||
[
|
||||
captchaToken,
|
||||
onSignIn,
|
||||
resetCaptchaToken,
|
||||
signInMutation,
|
||||
recordAuthMethod,
|
||||
],
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user