diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-04-01 20:08:00 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-04-01 20:08:00 -0400 |
commit | f6a068fdcef8b7650f010e4bb52f52a3b566e4bd (patch) | |
tree | 7d6042a88f0fb0fa35b642d484888777a7d3eb22 /data/stuff/test | |
parent | 6b9ca27c67d043a8737da652bf7915645628db4c (diff) | |
download | old-guff-f6a068fdcef8b7650f010e4bb52f52a3b566e4bd.tar.bz2 old-guff-f6a068fdcef8b7650f010e4bb52f52a3b566e4bd.zip |
add login test
Diffstat (limited to 'data/stuff/test')
-rw-r--r-- | data/stuff/test/auth.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/data/stuff/test/auth.js b/data/stuff/test/auth.js index 1bba095..408010b 100644 --- a/data/stuff/test/auth.js +++ b/data/stuff/test/auth.js @@ -91,6 +91,9 @@ jQuery(function($) { $('#create-user').click(function() { var me = $(this); + if (me.hasClass('disabled')) + return false; + // toggle loading me.toggleClass('disabled').find('.loading').toggleClass('hidden'); @@ -113,6 +116,43 @@ jQuery(function($) { return false; }); + $('#login').click(function() { + var me = $(this); + + if (me.hasClass('disabled')) + return false; + + // toggle loading + me.toggleClass('disabled').find('.loading').toggleClass('hidden'); + + send('test/login', { + email: $('#login-email').val(), + password: $('#login-password').val(), + }).always(function() { + // toggle loading + me.toggleClass('disabled').find('.loading').toggleClass('hidden'); + }).fail(function(r) { + alert('Error ' + r.responseText); + }).done(function(r) { + console.log(r); + }); + + // stop event + return false; + }); + + $('#login-user, #login-password').keydown(function(ev) { + if (ev.which == 13) { + setTimeout(function() { + // trigger login + $('#login').click(); + }, 10); + + // stop event + return false; + } + }); + $('#reload').click(reload); // load users |