forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with
_expirePasswordResetTokens
for meteor#7534
Also added a test to actually execute this code
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1468,6 +1468,20 @@ if (Meteor.isServer) (function () { | |
}, /Incorrect password/); | ||
}); | ||
|
||
Tinytest.add( | ||
'passwords - reset tokens get cleaned up', | ||
function (test) { | ||
var email = test.id + '[email protected]'; | ||
var userId = Accounts.createUser({email: email, password: 'password'}); | ||
Accounts.sendResetPasswordEmail(userId, email); | ||
test.isTrue(!!Meteor.users.findOne(userId).services.password.reset); | ||
|
||
Accounts._expirePasswordResetTokens(new Date(), userId); | ||
|
||
test.isUndefined(Meteor.users.findOne(userId).services.password.reset); | ||
} | ||
) | ||
|
||
// We should be able to change the username | ||
Tinytest.add("passwords - change username", function (test) { | ||
var username = Random.id(); | ||
|