From 315fadb7e110bd9e3b30fdfa27f6139e1eeaf7eb Mon Sep 17 00:00:00 2001 From: Sajad Mirjalili Date: Fri, 26 Sep 2025 17:06:29 +0330 Subject: [PATCH] fix: can redirect to password form from otp form --- public/locales/en/authentication.json | 3 ++- public/locales/fa/authentication.json | 5 ++-- .../AuthenticationSteps.tsx | 4 ++++ .../AuthenticationSteps/EnterPasswordForm.tsx | 22 +++++++++--------- .../AuthenticationSteps/OtpVerifyForm.tsx | 23 +++++++++++++++++-- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/public/locales/en/authentication.json b/public/locales/en/authentication.json index 6e016d2..6be9cb8 100644 --- a/public/locales/en/authentication.json +++ b/public/locales/en/authentication.json @@ -22,7 +22,8 @@ "resendCodeIn": "Resend code in", "moreMinute": "minute", "resendCode": "Resend code", - "confirmAndLogin": "Confirm & login" + "confirmAndLogin": "Confirm & login", + "loginWithPassword": "Login with password" }, "completeSignUp": { "completeSignUp": "Complete Sign Up", diff --git a/public/locales/fa/authentication.json b/public/locales/fa/authentication.json index 00081ca..e9b03ad 100644 --- a/public/locales/fa/authentication.json +++ b/public/locales/fa/authentication.json @@ -23,7 +23,8 @@ "youHaveSuccessfullySignedIn": "ثبت نام با موفقیت انجام شد", "resendCodeIn": "ارسال مجدد کد تا", "moreMinute": "دقیقه دیگر", - "resendCode": "ارسال مجدد" + "resendCode": "ارسال مجدد", + "loginWithPassword": "ورود با رمز" }, "completeSignUp": { "completeSignUp": "تکمیل ثبت نام", @@ -63,4 +64,4 @@ "redirectingTo": "در حال انتقال به", "redirecting": "درحال انتقال..." } -} +} \ No newline at end of file diff --git a/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx b/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx index 97beeae..0435e78 100644 --- a/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx +++ b/src/features/authentication/components/AuthenticationSteps/AuthenticationSteps.tsx @@ -30,6 +30,7 @@ export const AuthenticationSteps = (): JSX.Element => { const [addedPhoneNumberValue, setAddedPhoneNumberValue] = useState(''); const [memoryTokenRes, setMemoryTokenRes] = useState(); + const [hasPassword, setHasPassword] = useState(false); const { login } = useAuth(); const authFactory: AuthFactory = useMemo(() => { @@ -83,6 +84,7 @@ export const AuthenticationSteps = (): JSX.Element => { case UserStatus.RegisteredWithPassword: setAuthMode('login'); setCurrentStep('enterPassword'); + setHasPassword(true); break; } @@ -165,6 +167,8 @@ export const AuthenticationSteps = (): JSX.Element => { authMode={authMode} authType={authType} value={loginRegisterValue} + hasPassword={hasPassword} + onLoginWithPassword={() => setCurrentStep('enterPassword')} /> )} diff --git a/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx b/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx index d64c246..6080abd 100644 --- a/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx +++ b/src/features/authentication/components/AuthenticationSteps/EnterPasswordForm.tsx @@ -188,17 +188,17 @@ export const EnterPasswordForm = ({ sx={{ my: 4 }} /> - + + )} +