summaryrefslogtreecommitdiff
path: root/www/js/auth.js
diff options
context:
space:
mode:
authorPeterTheOne <petertheone@gmail.com>2016-01-29 14:06:18 (GMT)
committerPeterTheOne <petertheone@gmail.com>2016-01-29 14:06:18 (GMT)
commitf306d3578d0ec18e34df3b7ed30e20fa71339bf6 (patch)
treea95f562a6698d139e0a2901e3b7985a9080b0b5a /www/js/auth.js
parentc09725d1a62830d69daf8d286638e0d334394f78 (diff)
move authLogin function to rivendel.rh.js, use more namespaces in jingles
Diffstat (limited to 'www/js/auth.js')
-rw-r--r--www/js/auth.js32
1 files changed, 15 insertions, 17 deletions
diff --git a/www/js/auth.js b/www/js/auth.js
index 9bc83a8..c9fe52e 100644
--- a/www/js/auth.js
+++ b/www/js/auth.js
@@ -63,17 +63,6 @@ function auth_loginError(req, status, error) {
$("#password").val('');
}
-function auth_login() {
- $.ajax("/rh-bin/authtoken.json",
- { cache: false,
- username: $("#username").val(),
- password: $("#password").val(),
- dataType: "json",
- error: auth_loginError,
- success: auth_loginSuccess
- });
-}
-
function auth_logout() {
auth_cleanup();
apps_cleanup();
@@ -97,18 +86,27 @@ function auth_init() {
} else {
$("#mainwindow").hide();
}
- $("#loginform").submit(function(event) { auth_login(); event.preventDefault(); });
+ $("#loginform").submit(function(event) {
+ event.preventDefault();
+
+ Rivendell.Rivendell.authLogin(
+ '/rh-bin/authtoken.json',
+ $("#username").val(),
+ $("#password").val(),
+ auth_loginSuccess
+ ).fail(auth_loginError);
+ });
}
function auth_cleanup() {
sessionStorage.removeItem("auth_username");
- auth_username = null;
- $("#username").val('').focus();
-
sessionStorage.removeItem("auth_fullname");
- auth_fullname = null;
-
sessionStorage.removeItem("auth_token");
+
+ auth_username = null;
+ auth_fullname = null;
auth_token = null;
+
+ $("#username").val('').focus();
$("#password").val('');
}