|
|
|
@ -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);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|