]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/authmethods.js
push/pop destination_url instead of passing it through the chain
[citadel.git] / webcit / static / authmethods.js
index 57550687a0f177cd6a90f2dcd339337113e2a747..67018a7c2aaef8f59d639bc629f1289b371e5db2 100644 (file)
@@ -27,18 +27,20 @@ function GetLoggedInFirst(destination_url) {
 
        /* If logged in already, go directly to the destination. */
        if (IsLoggedIn()) {
-               window.location = destination_url;
+               window.location = decodeURIComponent(destination_url);
                return;
        }
 
+       p = 'push?url=' + destination_url;
+       new Ajax.Request(p, { method: 'get' } );
+
        /* If not logged in, go modal and ask the user to log in first. */
-       p = 'do_template?template=get_logged_in?destination_url=' + destination_url;
        new Ajax.Updater(
                'md-content',
-               p,
+               'do_template?template=get_logged_in',
                 {
                         method: 'get',
-                       onSuccess: function(cl_success) {
+                       onSuccess: function() {
                                toggleModal(1);
                        }
                 }
@@ -49,12 +51,13 @@ function GetLoggedInFirst(destination_url) {
 /*
  * Attempt login with username/password, called from modal dialog
  */
-function ajax_try_username_and_password(destination_url) {
+function ajax_try_username_and_password() {
+
        $('login_errmsg').innerHTML = "";
         $('ajax_username_password_form').request({
                onSuccess: function(ctdlresult) {
                        if (ctdlresult.responseText.substr(0,1) == '2') {
-                               window.location = destination_url;
+                               window.location = 'pop';
                        }
                        else {
                                $('login_errmsg').innerHTML = ctdlresult.responseText.substr(4) ;
@@ -62,3 +65,12 @@ function ajax_try_username_and_password(destination_url) {
                }
        });
 }
+
+/*
+ * tab handler for the login box
+ */
+function authtoggle(show_which_div) {
+       $('authbox_userpass').style.display = 'none';
+       $('authbox_openid').style.display = 'none';
+       $(show_which_div).style.display = 'block';
+}