Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): [nan-869] email verification on signup #2173

Merged
merged 17 commits into from
May 23, 2024

Conversation

khaliqgant
Copy link
Member

Describe your changes

Verify a user's email on signup and route them through an email verification flow.

Issue ticket number and link

NAN-869

Checklist before requesting a review (skip if just adding/editing APIs & templates)

  • I added tests, otherwise the reason is:
  • I added observability, otherwise the reason is:
  • I added analytics, otherwise the reason is:

Copy link

linear bot commented May 20, 2024

packages/server/lib/clients/workos.client.ts Show resolved Hide resolved
packages/server/lib/helpers/email.ts Outdated Show resolved Hide resolved
packages/server/lib/routes.ts Show resolved Hide resolved
packages/shared/lib/services/user.service.ts Outdated Show resolved Hide resolved
packages/shared/lib/services/user.service.ts Outdated Show resolved Hide resolved
packages/shared/lib/services/user.service.ts Outdated Show resolved Hide resolved
packages/shared/lib/services/user.service.ts Outdated Show resolved Hide resolved
@khaliqgant khaliqgant requested a review from TBonnin May 21, 2024 07:17
Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Massive work, especially on the API it's so much clearer like this 🚀

const user = getUser.value;

if (!user.email_verified) {
sendVerificationEmail(user.email, user.name, user.email_verification_token as string);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it's a huge side effect imo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, wasn't sure what to do here, but refactored it so that a button appears to re-trigger the verification email.

verification-email.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing 😍

packages/webapp/src/pages/VerifyEmail.tsx Outdated Show resolved Hide resolved
Comment on lines +56 to +57
const salt = crypto.randomBytes(16).toString('base64');
const hashedPassword = (await util.promisify(crypto.pbkdf2)(password, salt, 310000, 32, 'sha256')).toString('base64');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be worth factorizing this since it's used multiples times

packages/webapp/src/pages/VerifyEmail.tsx Outdated Show resolved Hide resolved
}
};

if (!loaded) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is seems more related to the button that the page, it flickers when clicking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't reproduce. Can you show an example of this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2024-05-22.at.09.49.45.mov

Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 💯
A few open comments but nothing blocking

@khaliqgant khaliqgant merged commit dec4e73 into master May 23, 2024
20 of 21 checks passed
@khaliqgant khaliqgant deleted the khaliq/nan-869-validate-email-on-signup-with-workos branch May 23, 2024 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants