Conversation
jdcc
left a comment
There was a problem hiding this comment.
A quick pass with a few questions
| import $ from 'jquery'; | ||
|
|
||
| Accounts.onResetPasswordLink((token, done) => { | ||
| Router.go('resetpwd'); |
There was a problem hiding this comment.
Why are you writing this manually instead of using one of the packages suggested in the Meteor docs?
| Router.go('resetpwd'); | ||
| }); | ||
|
|
||
| if (Accounts._resetPasswordToken) { |
There was a problem hiding this comment.
You shouldn't have code that's sitting outside functions like this. I think this is only getting run when the file is first imported.
| }); | ||
|
|
||
| if (Accounts._resetPasswordToken) { | ||
| Session.set('resetPasswordVar', Accounts._resetPasswordToken); |
There was a problem hiding this comment.
If you want to do it this way, you could set both the token and the done callback as elements in the Session object up after line 3.
| Template.resetpwd.events({ | ||
| 'keypress #newpasswordconfirm': function (event, template) { | ||
| event.which = event.which || event.keyCode; | ||
| if (event.which === 13) { |
There was a problem hiding this comment.
Set 13 to a named constant so we know which key it is without having to look it up.
| { reason: 'Internal server error', message: 'Please check your internet connection.' }, | ||
| ]; | ||
| const in1 = errorMessage.findIndex(x => x.reason === e.reason); | ||
| if (in1 === -1) { |
There was a problem hiding this comment.
This could be more readable as if (Object.keys(errorMessage).includes(e.reason)) { (and then switch the condition).
18c4e1e to
4167cce
Compare
Implements forgot password feature which allows users to change their passwords.