AfterClass-io / afterclass.io-v2

[alpha] v2 of https://afterclass.io!
https://afterclass-io.vercel.app
MIT License
4 stars 2 forks source link

feat: Email verification after sign up #103

Closed Jaylin0312 closed 3 months ago

Jaylin0312 commented 3 months ago

Closes #12

Changes

Implementation

  1. Certain email providers may prefetch URL links from incoming emails as part of a security feature. In this case, the confirmation url link sent by Supabase to the use will be consumed instantly, which leads to a "Token has expired or is invalid" error. To mitigate this, we have chosen to create a custom email link to redirect the user to a custom confirm sign up page. This implementation will require the user to actually clicks on the confirm sign up button to verify their identities. Refer supabase doc for more details
  2. For error handling, we are now redirecting user to not-found page if user tries to access the page by manipulating the urls directly
  3. For resend email function in supabase, I have enabled the function to accept ResendType as to make the function more generic (so that in the case where we need it for email_change in the future, we can reuse the function)

Testing

To set up the project locally for testing, follow the following steps:

  1. Install dependencies yarn install
  2. Run the development server yarn dev
  3. Head over to user sign up page
  4. Fill in valid school emails and password
  5. If account creation is successful, you should be redirected to email verification page
  6. Check your inbox for the supabase email verification link
  7. Once you click on the link, you should be redirected to sign up confirmation page
  8. Click on the Confirm Sign Up button and you should be redirected to log in page
  9. Log in using the credentials used in step 5, and click on log in button
  10. You should be able to see AfterClass' homepage successfully

Preview

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
afterclass-io-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 4:04pm