diff options
Diffstat (limited to 'www/js/auth.js')
-rw-r--r-- | www/js/auth.js | 32 |
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(''); } |