diff --git a/frontend/pages/signup.tsx b/frontend/pages/signup.tsx index 8991dc867..a5e17a8c5 100644 --- a/frontend/pages/signup.tsx +++ b/frontend/pages/signup.tsx @@ -40,8 +40,8 @@ const props = { backgroundColor: '#0d1117', color: 'white', border: '1px solid gray', - textAlign: 'center' - } + textAlign: 'center', + }, } as const; const propsPhone = { inputStyle: { @@ -56,8 +56,8 @@ const propsPhone = { backgroundColor: '#0d1117', color: 'white', border: '1px solid gray', - textAlign: 'center' - } + textAlign: 'center', + }, } as const; export default function SignUp() { @@ -81,6 +81,7 @@ export default function SignUp() { const router = useRouter(); const [errorLogin, setErrorLogin] = useState(false); const [isLoading, setIsLoading] = useState(false); + const [isResendingVerificationEmail, setIsResendingVerificationEmail] = useState(false); const [backupKeyError, setBackupKeyError] = useState(false); const [verificationToken, setVerificationToken] = useState(''); const [backupKeyIssued, setBackupKeyIssued] = useState(false); @@ -148,7 +149,8 @@ export default function SignUp() { } }; - // Verifies if the imformation that the users entered (name, workspace) is there, and if the password matched the criteria. + // Verifies if the imformation that the users entered (name, workspace) is there, and if the password matched the + // criteria. const signupErrorCheck = async () => { setIsLoading(true); let errorCheck = false; @@ -169,7 +171,7 @@ export default function SignUp() { setPasswordErrorLength, setPasswordErrorNumber, setPasswordErrorLowerCase, - currentErrorCheck: errorCheck + currentErrorCheck: errorCheck, }); if (!errorCheck) { @@ -186,8 +188,8 @@ export default function SignUp() { .slice(0, 32) .padStart( 32 + (password.slice(0, 32).length - new Blob([password]).size), - '0' - ) + '0', + ), }) as { ciphertext: string; iv: string; tag: string }; localStorage.setItem('PRIVATE_KEY', PRIVATE_KEY); @@ -195,7 +197,7 @@ export default function SignUp() { client.init( { username: email, - password: password + password: password, }, async () => { client.createVerifier( @@ -204,14 +206,14 @@ export default function SignUp() { email, firstName, lastName, - organizationName: firstName + "'s organization", + organizationName: firstName + '\'s organization', publicKey: PUBLIC_KEY, ciphertext, iv, tag, salt: result.salt, verifier: result.verifier, - token: verificationToken + token: verificationToken, }); // if everything works, go the main dashboard page. @@ -230,27 +232,37 @@ export default function SignUp() { setErrorLogin, router, true, - false + false, ); incrementStep(); } catch (error) { setIsLoading(false); } } - } + }, ); - } + }, ); } else { setIsLoading(false); } }; + const resendVerificationEmail = async () => { + setIsResendingVerificationEmail(true); + setIsLoading(true); + await sendVerificationEmail(email); + setTimeout(() => { + setIsLoading(false); + setIsResendingVerificationEmail(false); + }, 2000); + }; + // Step 1 of the sign up process (enter the email or choose google authentication) const step1 = (

- {"Let'"}s get started + {'Let\''}s get started

@@ -284,7 +296,7 @@ export default function SignUp() { acknowledged the Privacy Policy.

-
@@ -294,7 +306,7 @@ export default function SignUp() { const step2 = (

- {"We've"} sent a verification email to{' '} + {'We\'ve'} sent a verification email to{' '}

{email}{' '} @@ -328,13 +340,16 @@ export default function SignUp() {

- {/* - - */} +
+ + Not seeing an email? + + + + +

Make sure to check your spam inbox.

@@ -382,7 +397,7 @@ export default function SignUp() { setPasswordErrorLength, setPasswordErrorNumber, setPasswordErrorLowerCase, - currentErrorCheck: false + currentErrorCheck: false, }); }} type="password" @@ -506,7 +521,7 @@ export default function SignUp() { password, personalName: firstName + ' ' + lastName, setBackupKeyError, - setBackupKeyIssued + setBackupKeyIssued, }); const userWorkspaces = await getWorkspaces(); const userWorkspace = userWorkspaces[0]._id;