2 * Copyright 2010, the Citadel Team
3 * Licensed under the GPL V3
5 * JavaScript functions which handle various authentication methods.
10 * Wrapper script to require logging in before completing an action
12 function GetLoggedInFirst(destination_url) {
14 /* If logged in already, go directly to the destination. */
15 /* FIXME implement this */
17 /* If not logged in, go modal and ask the user to log in first. */
18 p = 'do_template?template=get_logged_in?destination_url=' + destination_url;
24 onSuccess: function(cl_success) {
33 * Attempt login with username/password, called from modal dialog
35 function ajax_try_username_and_password(destination_url) {
36 $('login_errmsg').innerHTML = "";
37 $('ajax_username_password_form').request({
38 onSuccess: function(ctdlresult) {
39 if (ctdlresult.responseText.substr(0,1) == '2') {
40 window.location = destination_url;
43 $('login_errmsg').innerHTML = ctdlresult.responseText.substr(4) ;