Added missing email field when registering user token (#2130)

GitOrigin-RevId: f7aaeae1f82e0188c838d7d1d975a81664950f78
This commit is contained in:
Miguel Serrano 2019-09-04 12:57:48 +02:00 committed by sharelatex
parent 7c68947100
commit dc6e4b3a12
2 changed files with 3 additions and 2 deletions

View file

@ -122,7 +122,7 @@ const UserRegistrationHandler = {
const ONE_WEEK = 7 * 24 * 60 * 60 // seconds
OneTimeTokenHandler.getNewToken(
'password',
user._id,
{ user_id: user._id.toString(), email },
{ expiresIn: ONE_WEEK },
(err, token) => {
if (err != null) {

View file

@ -282,8 +282,9 @@ describe('UserRegistrationHandler', function() {
})
it('should generate a new password reset token', function() {
const data = { user_id: this.user._id.toString(), email: this.email }
return this.OneTimeTokenHandler.getNewToken
.calledWith('password', this.user_id, { expiresIn: 7 * 24 * 60 * 60 })
.calledWith('password', data, { expiresIn: 7 * 24 * 60 * 60 })
.should.equal(true)
})