8000 mailedToken is not updated in the DB. · Issue #22 · hariacharya80/todoapp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
mailedToken is not updated in the DB. #22
Open
@hariacharya80

Description

@hariacharya80

Explanation:
When a new user signups, the backend sends a verification link to the email with a token. The same token is stored in the created user's data in that database in order to verify it once the link is clicked. Immediately after the user signups, they are redirected to the verify your email page. Everything works correctly till now. but in case the user miss the first email, or they wish to receive new verification link, the button on that page creates a new request to the backend. The backend generates a new token and sends the verification link to the email but the problem is, the token is not updated in the database and it is considered as invalid token when it comes to the verification endpoint.

Possible Fix:
Modify the SendVerificationEmail.controller.js to update the token after the email is sent.

Hint:

const updatedUser = await userModel.findOneAndUpdate({ email}, {mailedToken: newToken})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0