Fix verificationToken bug #2440
This commit is contained in:
parent
7e051a7549
commit
4480cd92ab
|
@ -474,7 +474,7 @@ module.exports = function(User) {
|
|||
fn(err);
|
||||
} else {
|
||||
if (user && user.verificationToken === token) {
|
||||
user.verificationToken = undefined;
|
||||
user.verificationToken = null;
|
||||
user.emailVerified = true;
|
||||
user.save(function(err) {
|
||||
if (err) {
|
||||
|
|
|
@ -1422,6 +1422,21 @@ describe('User', function() {
|
|||
}, done);
|
||||
});
|
||||
|
||||
it('sets verificationToken to null after confirmation', function(done) {
|
||||
testConfirm(function(result, done) {
|
||||
User.confirm(result.uid, result.token, false, function(err) {
|
||||
if (err) return done(err);
|
||||
|
||||
// Verify by loading user data stored in the datasource
|
||||
User.findById(result.uid, function(err, user) {
|
||||
if (err) return done(err);
|
||||
expect(user).to.have.property('verificationToken', null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}, done);
|
||||
});
|
||||
|
||||
it('Should report 302 when redirect url is set', function(done) {
|
||||
testConfirm(function(result, done) {
|
||||
request(app)
|
||||
|
|
Loading…
Reference in New Issue