2 * Copyright 2010, the Citadel Team
3 * Licensed under the GPL V3
5 * JavaScript functions which handle various authentication methods.
10 * Are we logged in right now?
12 function IsLoggedIn() {
13 if ($('is_logged_in').innerHTML == "yes") {
24 * Wrapper script to require logging in before completing an action
26 function GetLoggedInFirst(destination_url) {
28 /* If logged in already, go directly to the destination. */
30 window.location = decodeURIComponent(destination_url);
34 /* If not logged in, go modal and ask the user to log in first. */
35 p = 'do_template?template=get_logged_in?destination_url=' + destination_url;
41 onSuccess: function(cl_success) {
50 * Attempt login with username/password, called from modal dialog
52 function ajax_try_username_and_password(destination_url) {
54 $('login_errmsg').innerHTML = "";
55 $('ajax_username_password_form').request({
56 onSuccess: function(ctdlresult) {
57 if (ctdlresult.responseText.substr(0,1) == '2') {
58 window.location = decodeURIComponent(destination_url);
61 $('login_errmsg').innerHTML = ctdlresult.responseText.substr(4) ;
68 * tab handler for the login box
70 function authtoggle(show_which_div) {
71 $('authbox_userpass').style.display = 'none';
72 $('authbox_openid').style.display = 'none';
73 $(show_which_div).style.display = 'block';