summaryrefslogtreecommitdiff
path: root/src/client/user_login.js
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-02-04 03:05:19 +0200
committerLV-426 <lv-426@taproot.org.il>2015-02-04 03:05:19 +0200
commit69aa1c4b335136c1028bec5a9b83f17eeb8b0b8d (patch)
tree3376de51b704b232a6db91252d2420d172958329 /src/client/user_login.js
parent94980b6de8abf7709331ed282b609796deb2c867 (diff)
login.html: refactor code into user_login.js
Diffstat (limited to 'src/client/user_login.js')
-rw-r--r--src/client/user_login.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/user_login.js b/src/client/user_login.js
new file mode 100644
index 00000000..3e304b64
--- /dev/null
+++ b/src/client/user_login.js
@@ -0,0 +1,26 @@
+"use strict"
+
+function submit_login_form() {
+ var data = {
+ username : $('#login_username').val(),
+ password : $('#login_password').val()
+ };
+
+ // TODO: validate
+
+ $.ajax({
+ type : "POST",
+ url: '/login',
+ async : false,
+ cache : false,
+ data : JSON.stringify(data),
+ dataType : 'json',
+ contentType : "application/json; charset=utf-8",
+ success : function () {
+ document.location = "/index";
+ },
+ error : function (xhr, status, err_thrown) {
+ $('#failed-login').show();
+ }
+ });
+}