Refactor user login, change password to use colander/deform
This commit is contained in:
parent
cff757fe9e
commit
ec438ead51
5 changed files with 53 additions and 69 deletions
|
@ -1,24 +1,24 @@
|
|||
|
||||
$(function() {
|
||||
|
||||
$('#username').keydown(function(event) {
|
||||
$('input[name="username"]').keydown(function(event) {
|
||||
if (event.which == 13) {
|
||||
$('#password').focus().select();
|
||||
$('input[name="password"]').focus().select();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
$('form').submit(function() {
|
||||
if (! $('#username').val()) {
|
||||
with ($('#username').get(0)) {
|
||||
if (! $('input[name="username"]').val()) {
|
||||
with ($('input[name="username"]').get(0)) {
|
||||
select();
|
||||
focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (! $('#password').val()) {
|
||||
with ($('#password').get(0)) {
|
||||
if (! $('input[name="password"]').val()) {
|
||||
with ($('input[name="password"]').get(0)) {
|
||||
select();
|
||||
focus();
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ $(function() {
|
|||
return true;
|
||||
});
|
||||
|
||||
$('#username').focus();
|
||||
$('input[name="username"]').focus();
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue