regenerate email hash on profile update

This commit is contained in:
Sacha Greif 2014-09-12 11:54:04 +09:00
parent 67de4f432a
commit f67ad0b7ae
2 changed files with 5 additions and 2 deletions

View file

@ -84,6 +84,9 @@ Template[getTemplate('user_edit')].events({
$('html, body').animate({scrollTop: element.offset().top});
});
});
Meteor.call('setEmailHash', user);
}
});

View file

@ -110,7 +110,7 @@ Meteor.methods({
return Math.abs(object.score - newScore);
},
setEmailHash: function(user){
var email_hash = CryptoJS.MD5(getEmail(user).trim().toLowerCase()).toString();
Meteor.users.update(user._id, {$set : {email_hash : email_hash}});
var hash = getEmailHash(user);
Meteor.users.update(user._id, {$set : {email_hash : hash}});
}
});