aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/stuff/test/auth.js40
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