delete old email key before setting new one when someone changes their email

v1.18.x
Baris Soner Usakli 12 years ago
parent 41b3eabf1a
commit a7ed1f97df

@ -230,7 +230,10 @@ var utils = require('./../public/src/utils.js'),
if(data[key] !== undefined) { if(data[key] !== undefined) {
if(key === 'email') { if(key === 'email') {
User.setUserField(uid, 'gravatarpicture', User.createGravatarURLFromEmail(data[key])); User.setUserField(uid, 'gravatarpicture', User.createGravatarURLFromEmail(data[key]));
RDB.set('email:' + data['email'] +':uid', uid); user.getUserField(uid, 'email', function(email) {
RDB.del('email:' + email + ':uid');
RDB.set('email:' + data['email'] + ':uid', uid);
});
} else if(key === 'signature') { } else if(key === 'signature') {
data[key] = utils.strip_tags(data[key]); data[key] = utils.strip_tags(data[key]);
} }

Loading…
Cancel
Save