-
Notifications
You must be signed in to change notification settings - Fork 70
[1 / 3] - Backend Functionality for Reset Password #223
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
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/c0d3/c0d3-app/9sjz6t20v |
Codecov Report
@@ Coverage Diff @@
## master #223 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 44 47 +3
Lines 596 679 +83
Branches 138 151 +13
=========================================
+ Hits 596 679 +83
|
| } | ||
|
|
||
| let user: any | ||
| if (userOrEmail.indexOf('@') !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a really useful util function, like const user = getUserByEmailOrUsername( userOrEmail )
Util function could do the throwing and input validation, making this reqPwReset function much smaller.
Util function will throw invalid input and user does not exist, so you are guaranteed to have a user object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make this a util function, we could potentially use this in login as well!
| user.expiration = null | ||
| user.forgotToken = null | ||
| user.password = hash | ||
| await user.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to do this after changeChatPassword. This prevents our pw from being out of sync with chat.
| .max(TEXT_MAX, `Must be ${TEXT_MAX} characters or less`) | ||
| .trim('Leading and trailing value must be alphanumeric character') | ||
| .required('Required'), | ||
| password: Yup.string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this affect the signup password validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooo there's no password inputs for signup anymore :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to move this to a different PR. I don't want to break production on this one.
This is part of multiple PRs to add reset Password functionality
The second PR will add the resolvers to GraphQL server, update Signup and make changes to Front End
Screenshot for Reset Password Email Template
