added signup v3 endpoints and developed initial new signup flow

This commit is contained in:
Sheen Capadngan
2023-05-04 01:32:40 +08:00
parent f703ee29e5
commit 1172726e74
15 changed files with 243 additions and 34 deletions
@@ -8,6 +8,7 @@ interface Props {
protectedKey: string;
protectedKeyIV: string;
protectedKeyTag: string;
providerAuthToken?: string;
publicKey: string;
encryptedPrivateKey: string;
encryptedPrivateKeyIV: string;
@@ -49,9 +50,10 @@ const completeAccountInformationSignup = async ({
encryptedPrivateKeyTag,
salt,
verifier,
organizationName
organizationName,
providerAuthToken,
}: Props) => {
const { data } = await apiRequest.post('/api/v2/signup/complete-account/signup', {
const { data } = await apiRequest.post('/api/v3/signup/complete-account/signup', {
email,
firstName,
lastName,
@@ -64,7 +66,8 @@ const completeAccountInformationSignup = async ({
encryptedPrivateKeyTag,
salt,
verifier,
organizationName
organizationName,
providerAuthToken,
});
return data;
-1
View File
@@ -12,7 +12,6 @@ interface Login1 {
const login1 = async (loginDetails: {
email: string;
clientPublicKey: string;
userId?: string;
}) => {
const response = await fetch("/api/v2/auth/login1", {
method: "POST",
-1
View File
@@ -20,7 +20,6 @@ interface Login2Response {
const login2 = async (loginDetails: {
email: string;
clientProof: string;
userId?: string;
}) => {
const response = await fetch('/api/v2/auth/login2', {
method: 'POST',
-2
View File
@@ -25,7 +25,6 @@ export default function Login() {
const [isLoginWithEmail, setIsLoginWithEmail] = useState(false);
const {
providerAuthToken,
userId,
email: providerEmail,
setProviderAuthToken
} = useProviderAuth();
@@ -57,7 +56,6 @@ export default function Login() {
if (providerAuthToken && step === 1) {
return (
<PasswordInputStep
userId={userId}
email={providerEmail}
password={password}
setPassword={setPassword}
+5 -4
View File
@@ -35,7 +35,7 @@ export default function SignUp() {
const { data: serverDetails } = useFetchServerStatus();
const [isSignupWithEmail, setIsSignupWithEmail] = useState(false);
const { t } = useTranslation();
const { providerAuthToken } = useProviderAuth();
const { email: providerEmail, providerAuthToken } = useProviderAuth();
if (providerAuthToken && step < 3) {
setStep(3);
@@ -99,7 +99,7 @@ export default function SignUp() {
return (
<>
<button type='button' className='text-white' onClick={() => {
window.open('/api/v1/auth/login/google')
window.open('/api/v1/oauth/redirect/google')
}}>
Continue with Google
</button>
@@ -127,13 +127,14 @@ export default function SignUp() {
return (
<UserInfoStep
incrementStep={incrementStep}
email={email}
email={email || providerEmail}
password={password}
setPassword={setPassword}
firstName={firstName}
setFirstName={setFirstName}
lastName={lastName}
setLastName={setLastName}
providerAuthToken={providerAuthToken}
/>
)
}
@@ -142,7 +143,7 @@ export default function SignUp() {
return (
<DownloadBackupPDF
incrementStep={incrementStep}
email={email}
email={email || providerEmail}
password={password}
name={`${firstName} ${lastName}`}
/>