feat: login with password apis added
This commit is contained in:
@@ -5,7 +5,11 @@ import { OtpVerifyForm } from './OtpVerifyForm';
|
||||
import { isNumeric } from '@/utils/regexes/isNumeric';
|
||||
import { CompleteSignUp } from './CompleteSignUp';
|
||||
import { EnterPasswordForm } from './EnterPasswordForm';
|
||||
import { getUserStatusByPhoneNumberOrEmail } from '../../api/authorizationAPI';
|
||||
import {
|
||||
getUserStatusByPhoneNumberOrEmail,
|
||||
sendEmailOtp,
|
||||
sendSmsOtp,
|
||||
} from '../../api/authorizationAPI';
|
||||
import { UserStatus } from '../../types/userTypes';
|
||||
import type { CountryCode, GUID } from '@/types/commonTypes';
|
||||
import { VerifyPhoneNumber } from './VerifyPhoneNumber';
|
||||
@@ -51,11 +55,16 @@ export const AuthenticationSteps = (): JSX.Element => {
|
||||
const handleOTPVerfied = (
|
||||
registeredWithoutPhoneNumber: boolean = false,
|
||||
userId: GUID,
|
||||
returnUrl?: string,
|
||||
) => {
|
||||
localStorage.setItem('userID', userId);
|
||||
// if (registeredWithoutPhoneNumber) {
|
||||
// setCurrentStep('addPhoneNumber');
|
||||
// }
|
||||
|
||||
if (returnUrl) {
|
||||
location.href = returnUrl;
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditValue = () => {
|
||||
@@ -74,7 +83,17 @@ export const AuthenticationSteps = (): JSX.Element => {
|
||||
setCurrentStep('emailOrPhone');
|
||||
};
|
||||
|
||||
const handleLoggedInWithPassowrd = () => {};
|
||||
const handleLoggedInWithPassowrd = (userId: GUID, returnUrl?: string) => {
|
||||
localStorage.setItem('userID', userId);
|
||||
|
||||
if (returnUrl) {
|
||||
location.href = returnUrl;
|
||||
}
|
||||
};
|
||||
|
||||
const handleLoginWithOtpInsteadOfPassword = async () => {
|
||||
setCurrentStep('verify');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -103,9 +122,12 @@ export const AuthenticationSteps = (): JSX.Element => {
|
||||
|
||||
{currentStep === 'enterPassword' && (
|
||||
<EnterPasswordForm
|
||||
loginRegisterValue={loginRegisterValue}
|
||||
countryCode={countryCode}
|
||||
authType={authType}
|
||||
onLoggedIn={handleLoggedInWithPassowrd}
|
||||
onEditValue={handleEditValue}
|
||||
onLoginWithOTP={() => setCurrentStep('verify')}
|
||||
onLoginWithOTP={handleLoginWithOtpInsteadOfPassword}
|
||||
emailOrPhone={loginRegisterValue}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user