forked from 0x2620/pandora
fix changing email, pandora.validateNewEmail has to pass value to callback
This commit is contained in:
parent
e24f83d4c6
commit
8f3aa15eb4
1 changed files with 7 additions and 4 deletions
|
@ -49,20 +49,23 @@ pandora.validateCode = function(value, callback) {
|
|||
pandora.validateNewEmail = function(value, callback) {
|
||||
value == pandora.user.email ? callback({
|
||||
message: '',
|
||||
valid: true
|
||||
valid: true,
|
||||
value: value
|
||||
}) : Ox.isValidEmail(value) ? pandora.api.findUser({
|
||||
key: 'email',
|
||||
value: value,
|
||||
operator: '=='
|
||||
}, function(result) {
|
||||
callback({
|
||||
message: Ox._('E-Mail Address already exists'),
|
||||
valid: !result.data.users.length
|
||||
message: !!result.data.users.length ? Ox._('E-Mail Address already exists') : '',
|
||||
valid: !result.data.users.length,
|
||||
value: value
|
||||
});
|
||||
}) : callback({
|
||||
message: value.length ? Ox._('Invalid e-mail address') : '',
|
||||
// message: (!value.length ? 'Missing' : 'Invalid') + ' e-mail address',
|
||||
valid: false
|
||||
valid: false,
|
||||
value: value
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue