#1110 - moved isEmailAvailable into User.email

v1.18.x
Julian Lam 11 years ago
parent e0dcf95138
commit e956c19587

@ -58,7 +58,7 @@ var bcrypt = require('bcryptjs'),
},
function(next) {
if (userData.email) {
User.isEmailAvailable(userData.email, function(err, available) {
User.email.available(userData.email, function(err, available) {
if (err) {
return next(err);
}
@ -278,7 +278,7 @@ var bcrypt = require('bcryptjs'),
return next(null, true);
}
User.isEmailAvailable(data.email, function(err, available) {
User.email.available(data.email, function(err, available) {
if (err) {
return next(err, null);
}
@ -422,12 +422,6 @@ var bcrypt = require('bcryptjs'),
});
};
User.isEmailAvailable = function(email, callback) {
db.isObjectField('email:uid', email, function(err, exists) {
callback(err, !exists);
});
};
User.changePassword = function(uid, data, callback) {
if(!data || !data.uid) {
return callback(new Error('invalid-uid'));
@ -1029,6 +1023,11 @@ var bcrypt = require('bcryptjs'),
});
}
});
},
available: function(email, callback) {
db.isObjectField('email:uid', email, function(err, exists) {
callback(err, !exists);
});
}
};

Loading…
Cancel
Save