fix changing email, pandora.validateNewEmail has to pass value to callback

This commit is contained in:
j 2013-09-29 11:25:08 +00:00
parent e24f83d4c6
commit 8f3aa15eb4

View file

@ -49,20 +49,23 @@ pandora.validateCode = function(value, callback) {
pandora.validateNewEmail = function(value, callback) { pandora.validateNewEmail = function(value, callback) {
value == pandora.user.email ? callback({ value == pandora.user.email ? callback({
message: '', message: '',
valid: true valid: true,
value: value
}) : Ox.isValidEmail(value) ? pandora.api.findUser({ }) : Ox.isValidEmail(value) ? pandora.api.findUser({
key: 'email', key: 'email',
value: value, value: value,
operator: '==' operator: '=='
}, function(result) { }, function(result) {
callback({ callback({
message: Ox._('E-Mail Address already exists'), message: !!result.data.users.length ? Ox._('E-Mail Address already exists') : '',
valid: !result.data.users.length valid: !result.data.users.length,
value: value
}); });
}) : callback({ }) : callback({
message: value.length ? Ox._('Invalid e-mail address') : '', message: value.length ? Ox._('Invalid e-mail address') : '',
// message: (!value.length ? 'Missing' : 'Invalid') + ' e-mail address', // message: (!value.length ? 'Missing' : 'Invalid') + ' e-mail address',
valid: false valid: false,
value: value
}); });
}; };