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: By-pass email verification on development environment #404

Closed
2 tasks done
vinayak-vohra opened this issue Jul 17, 2024 · 5 comments · Fixed by #408
Closed
2 tasks done

Feat: By-pass email verification on development environment #404

vinayak-vohra opened this issue Jul 17, 2024 · 5 comments · Fixed by #408
Assignees
Labels
⭐ enhancement Feature enhancement gssoc GSSOC'24 Required Label level2 25 points MEDIUM Difficulty Level: Medium

Comments

@vinayak-vohra
Copy link
Contributor

What feature?

Currently email verification is required even in development environment. This creates hinderance when developing & testing features which require multiple accounts. (such as like, comments etc.)

I propose we bypass the email verification in development environment and use it only in the production environment.
This will allow the developers to use any email on their local environment, improving developer experience and efficiency .

Add screenshots

No response

Record

  • I agree to follow this project's Code of Conduct
  • I want to work on this issue
@vinayak-vohra vinayak-vohra added the ⭐ enhancement Feature enhancement label Jul 17, 2024
Copy link

Congratulations, @vinayak-vohra! 🎉 Thank you for creating the issue. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work!

'We will promptly review your changes and offer feedback. Keep up the excellent work!
Kindly remember to check our Contributing Guidelines'

@Sanchitbajaj02
Copy link
Owner

Hi @vinayak-vohra
Can you explain me your proposal on how you are going to implement it?

@Sanchitbajaj02 Sanchitbajaj02 added level2 25 points gssoc GSSOC'24 Required Label INTERMEDIATE Difficulty Level: Intermediate MEDIUM Difficulty Level: Medium and removed INTERMEDIATE Difficulty Level: Intermediate labels Jul 18, 2024
@vinayak-vohra
Copy link
Contributor Author

@Sanchitbajaj02 sure.

  • Using the environment variable NODE_ENV we can check the mode i.e., 'development' or 'production'.
  • Then adding simple check before sending the verification email. Only send if env is production.
  • Finally, in middleware.ts we have checks to redirect to homepage if user is not verified. We can add another condition to check for the environment and only redirect when in production mode.

When starting the server in dev mode using yarn dev, no verification email is sent, and the middleware logic allows access to site without the need of verification.

When starting the server in production mode by yarn build and yarn start, the site will behave as it currently is.

@vinayak-vohra
Copy link
Contributor Author

@Sanchitbajaj02 I just found a better approach. When creating user account after register, set the isVerified attribute as true when in development environment. We won't need to change anything in the middleware.

Copy link

Hello @vinayak-vohra! Your issue #404 has been closed. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Feature enhancement gssoc GSSOC'24 Required Label level2 25 points MEDIUM Difficulty Level: Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants