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 #408

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

vinayak-vohra
Copy link
Contributor

@vinayak-vohra vinayak-vohra commented Jul 19, 2024

Related Issue

fixes: #404

Description

Development mode
When the app is started in development mode by running yarn dev:

  • the user is verified by default.
  • no verification email is sent.
  • user is redirected to their feed

Production mode
When the app is started in production mode by running yarn build and yarn start, the flow is same as now:

  • a verification mail is sent to provided email id.
  • user is redirected to verify page.
  • user needs to verify themselves before accessing feed.

Screenshots

Development Mode

Palettegram-dev.mp4

Production Mode

Palettegram-prod.mp4

Summary by CodeRabbit

  • New Features

    • Enhanced user registration process with conditional messaging based on the environment.
    • In production, users receive verification email prompts; in development, the process is streamlined for testing.
  • Bug Fixes

    • Resolved issues with user redirection post-registration, ensuring appropriate navigation based on the environment.

Copy link

vercel bot commented Jul 19, 2024

@vinayak-vohra is attempting to deploy a commit to the Sanchit Bajaj's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Jul 19, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The recent changes refine the user verification process by implementing conditional logic based on the application's environment. In production, users must verify their emails, while in development, this step is skipped to facilitate easier testing and account management. This enhancement significantly boosts the developer experience by streamlining workflows and enabling immediate access to application features without the need for email confirmation.

Changes

Files Change Summary
src/backend/auth.api.ts Introduced conditional logic for sending verification emails and setting user status based on environment (production/dev).
src/components/pages/auth/register/index.tsx Modified registration success handling to redirect users based on the environment.

Assessment against linked issues

Objective Addressed Explanation
Bypass email verification in development environment (#404)
Improve developer experience and efficiency by skipping verification (#404)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @vinayak-vohra! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project. Keep being the part of the community!

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3bcc009 and d1e3e18.

Files selected for processing (2)
  • src/backend/auth.api.ts (2 hunks)
  • src/components/pages/auth/register/index.tsx (1 hunks)
Additional comments not posted (3)
src/backend/auth.api.ts (2)

251-254: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to saveDataToDatabase properly handle the new conditional logic for the isVerified field.

Verification successful

The function usage is verified and the new conditional logic for the isVerified field is properly handled within the codebase.

  • The function saveDataToDatabase is defined and used within src/backend/auth.api.ts.
  • The new conditional logic for the isVerified field is implemented and properly handled within the function.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `saveDataToDatabase` handle the new conditional logic for the `isVerified` field.

# Test: Search for the function usage. Expect: Proper handling of the new conditional logic.
rg --type javascript -A 5 $'saveDataToDatabase'

Length of output: 81


Script:

#!/bin/bash
# Description: Verify all function calls to `saveDataToDatabase` handle the new conditional logic for the `isVerified` field.

# Test: Search for the function usage. Expect: Proper handling of the new conditional logic.
rg --type js -A 5 $'saveDataToDatabase'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the existence and usage of the function `saveDataToDatabase` across all file types.

# Test: Search for the function definition. Expect: Function definition to be found.
rg 'function saveDataToDatabase'

# Test: Search for the function usage. Expect: Proper handling of the new conditional logic.
rg 'saveDataToDatabase'

Length of output: 412


Script:

#!/bin/bash
# Description: Review the context around the function calls and definition of `saveDataToDatabase` in `src/backend/auth.api.ts`.

# Extract lines around the function definition
rg 'const saveDataToDatabase = async' -A 10 -B 5 src/backend/auth.api.ts

# Extract lines around the function calls
rg 'saveDataToDatabase' -A 5 -B 5 src/backend/auth.api.ts

Length of output: 1780


50-58: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to register properly handle the new conditional logic for email verification.

Verification successful

No current usages of the register function found.

The new conditional logic for email verification in the register function does not impact any existing code, as there are no calls to this function in the codebase. Ensure proper handling of this logic when the function is used in the future.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `register` handle the new conditional logic for email verification.

# Test: Search for the function usage. Expect: Proper handling of the new conditional logic.
rg --type javascript -A 5 $'register'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify all function calls to `register` handle the new conditional logic for email verification.

# Find all JavaScript and TypeScript files and search for the function usage.
fd -e js -e ts | xargs rg 'register'

Length of output: 589


Script:

#!/bin/bash
# Description: Specifically search for function calls to `register` within the codebase.

# Find all JavaScript and TypeScript files and search for function calls to `register`.
fd -e js -e ts | xargs rg '\bregister\b\s*\('

Length of output: 47


Script:

#!/bin/bash
# Description: Specifically search for function calls to `register` within the codebase, including more context lines.

# Find all JavaScript and TypeScript files and search for function calls to `register`, including 10 lines of context.
fd -e js -e ts | xargs rg 'register' -A 10 -B 10

Length of output: 6683

src/components/pages/auth/register/index.tsx (1)

92-98: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to RegisterComponent properly handle the new conditional logic for user experience.

@Sanchitbajaj02 Sanchitbajaj02 added ⭐ enhancement Feature enhancement MEDIUM Difficulty Level: Medium level2 25 points and removed wait for reviewers labels Jul 23, 2024
@Sanchitbajaj02 Sanchitbajaj02 merged commit f4405d6 into Sanchitbajaj02:master Jul 29, 2024
3 of 4 checks passed
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 this pull request may close these issues.

Feat: By-pass email verification on development environment
2 participants