remove some annoying 'missing username/password/e-mail' messages

This commit is contained in:
rolux 2011-11-07 09:58:37 +00:00
parent 94a9a59718
commit 3bed914023
3 changed files with 31 additions and 25 deletions

View File

@ -204,12 +204,7 @@ pandora.ui.accountForm = function(action, value) {
id: 'code',
label: 'Code',
labelWidth: 120,
validate: function(value, callback) {
callback({
message: 'Missing code',
valid: value.length > 0
});
},
validate: pandora.validateCode,
width: 320
});
} else if (type == 'email') {
@ -257,12 +252,7 @@ pandora.ui.accountForm = function(action, value) {
label: 'Password',
labelWidth: 120,
type: 'password',
validate: function(value, callback) {
callback({
message: 'Missing password',
valid: value.length > 0
});
},
validate: pandora.validatePassword,
width: 320
});
} else if (type == 'username') {
@ -295,7 +285,8 @@ pandora.ui.accountForm = function(action, value) {
? pandora.autovalidateUsername : pandora.autovalidateEmail,
validate: pandora.validateUser(selected, true),
value: ''
}).focus();
}).focusInput();
//setTimeout(that.submit, 250);
pandora.$ui.accountDialog.disableButton('submitReset');
}
}),

View File

@ -38,11 +38,18 @@ pandora.autovalidateUsername = function(value, blur, callback) {
callback({valid: !!value.length, value: value});
};
pandora.validateCode = function(value, callback) {
callback({
message: '',
// message: 'Missing code',
valid: value.length > 0
});
};
pandora.validateNewEmail = function(value, callback) {
value == pandora.user.email ? callback({
message: '',
valid: true,
value: value
valid: true
}) : Ox.isValidEmail(value) ? pandora.api.findUser({
key: 'email',
value: value,
@ -50,21 +57,28 @@ pandora.validateNewEmail = function(value, callback) {
}, function(result) {
callback({
message: 'E-mail address already exists',
valid: !result.data.users.length,
value: value
valid: !result.data.users.length
});
}) : callback({
message: (!value.length ? 'Missing' : 'Invalid') + ' e-mail address',
message: value.length ? 'Invalid e-mail address' : '',
// message: (!value.length ? 'Missing' : 'Invalid') + ' e-mail address',
valid: false,
value: value
});
};
pandora.validateNewPassword = function(value, callback) {
callback({
message: 'Missing password',
valid: value.length > 0,
value: value
message: '',
// message: 'Missing password',
valid: value.length > 0
});
};
pandora.validatePassword = function(value, callback) {
callback({
message: '',
// message: 'Missing password',
valid: value.length > 0
});
};
@ -79,7 +93,6 @@ pandora.validateUser = function(key, existing) {
operator: '=='
}, function(result) {
var valid = existing == !!result.data.users.length;
//Ox.Log('', existing, result.data.users)
callback({
message: existing ?
'Unknown ' + string :
@ -87,7 +100,8 @@ pandora.validateUser = function(key, existing) {
valid: valid
});
}) : callback({
message: (!value.length ? 'Missing' : 'Invalid') + ' ' + string,
message: value.length ? 'Invalid ' + string : '',
// message: (!value.length ? 'Missing' : 'Invalid') + ' ' + string,
valid: false
});
};

View File

@ -64,9 +64,10 @@ pandora.ui.siteDialog = function(section) {
$dialog.options({
title: Ox.getObjectById(tabs, data.selected).title
});
pandora.URL.replace('/' + data.selected);
//fixme: this should be using URL.push / UI.set
//but that currenlty causes another dialog to be opened
history.pushState({}, '', '/' + data.selected);
//history.pushState({}, '', '/' + data.selected);
}
});
var $dialog = Ox.Dialog({