diff --git a/.gitignore b/.gitignore index c8783acef..d28941d6e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,6 @@ app/utils/config.js config.yml .DS_Store yarn.lock - +.vscode cypress/videos/** cypress/screenshots/** diff --git a/app/pages/Auth/SignUpPage.tsx b/app/pages/Auth/SignUpPage.tsx index fe5c3e8ea..5d2bb349b 100644 --- a/app/pages/Auth/SignUpPage.tsx +++ b/app/pages/Auth/SignUpPage.tsx @@ -48,7 +48,7 @@ export const SignUpPage = () => { We want to make sure that your account information is safe, so you will be sent a verification code to your email each time you log in. Please enter in your email address and then check your email to find - a 5-number verification code. + a 6 digit verification code.

{ - passwordlessLogin(authClient, email, verificationCode); - // Store user sign up data, which will be saved to our backend after Auth0 success redirect - setUserSignUpData({ email, name, organization }); + passwordlessLogin(authClient, email, verificationCode, { + email, + name, + organization, + }); }; /** This method initiates the log-in/sign-up process by sending a code @@ -99,7 +101,8 @@ export const passwordlessStart = (authClient: WebAuth, email: string) => { export const passwordlessLogin = ( authClient: WebAuth, email: string, - verificationCode: string + verificationCode: string, + userSignUpData?: UserSignUpData ) => { const stateToken = createStateToken(); sessionStorage.setItem("authStateToken", stateToken); @@ -117,6 +120,8 @@ export const passwordlessLogin = ( } } ); + // Store user sign up data, which will be saved to our backend after Auth0 success redirect + setUserSignUpData(userSignUpData ?? { email, name: "", organization: null }); }; export const logout = ( @@ -154,7 +159,7 @@ export const saveUser = ( authToken: string ) => { return post( - "/api/users", + "/api/v2/users", { ...userSignUpData, user_external_id: userExternalId }, { Authorization: `Bearer ${authToken}` } ); diff --git a/app/utils/useAppContext.tsx b/app/utils/useAppContext.tsx index 5eec79b57..beb06785c 100644 --- a/app/utils/useAppContext.tsx +++ b/app/utils/useAppContext.tsx @@ -96,11 +96,11 @@ export const AppProvider = ({ // If the SessionCacher has userSignUpData object, that means a user has just been created // in Auth0 and a redirect has occurred. Therefore, we save the new user data to our database. // The authState must also have propagated or else we won't have the token yet. - const newUserData = SessionCacher.getUserSignUpData(); - if (newUserData && authState) { + const userData = SessionCacher.getUserSignUpData(); + if (userData && authState) { SessionCacher.clearUserSignUpData(); AuthService.saveUser( - newUserData, + userData, authState.user.externalId, authState.accessTokenObject.token );