Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.

Commit 8324d84

Browse files
authored
Merge pull request #17 from js-accounts/reset-reason
Add reason param to addResetPasswordToken
2 parents 47d2960 + 1d482e0 commit 8324d84

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,14 @@ class Mongo {
256256
});
257257
}
258258

259-
async addResetPasswordToken(userId: string, email: string, token: string): Promise<void> {
259+
async addResetPasswordToken(userId: string, email: string, token: string, reason: string = 'reset'): Promise<void> {
260260
await this.collection.update({ _id: userId }, {
261261
$push: {
262262
'services.password.reset': {
263263
token,
264264
address: email.toLowerCase(),
265265
when: Date.now(),
266+
reason,
266267
},
267268
},
268269
});

src/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ describe('Mongo', () => {
451451
expect(retUser.services.password.reset[0].address).toEqual('[email protected]');
452452
expect(retUser.services.password.reset[0].token).toEqual('token');
453453
expect(retUser.services.password.reset[0].when).toBeTruthy();
454+
expect(retUser.services.password.reset[0].reason).toEqual('reset');
454455
});
455456
});
456457

0 commit comments

Comments
 (0)