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

Mutations for forgot-password and add session store #118

Closed
wants to merge 4 commits into from

Conversation

mohit038-zz
Copy link
Contributor

This PR adds mutations for forget-password.

Implementation: The idea is to generate a token, save it in Redis, and send it in a link to the user's email. Then that link will land on the new password page. On this page, we will retrieve the token from the URL and call the change-password mutation
endpoint with the token and newly selected password. Then this mutation checks whether the token is valid or not. A token can be used only once to change the password and expires in 24 hrs.

Package:
UUID: To generate a token
Nodemailer: To send an email:
and Redis to store tokens


export const server = new ApolloServer({
schema: loadSchema(),
context: buildContext,
context: ({ req, res }) => buildContext({ req, res, redis }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find any way to pass this redis client to buildcontext function to access it inside resolvers. So For the time being I hard-coded in the node-module. This function is from graphql-passport (node_modules/graphql-passport/lib/buildContext.d.ts). I don't think it the correct way to do this.

@mohit038-zz mohit038-zz deleted the forgot-password-mutation branch May 18, 2021 13:08
tobiasdiez pushed a commit that referenced this pull request Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants