push/pop destination_url instead of passing it through the chain
authorArt Cancro <ajc@citadel.org>
Wed, 5 Jan 2011 21:18:18 +0000 (16:18 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 5 Jan 2011 21:18:18 +0000 (16:18 -0500)
webcit/static/authmethods.js
webcit/static/t/get_logged_in.html
webcit/webcit.c
webcit/webcit.h
webcit/webserver.c

index 1fc45a03c37d7b7e154c64bf979b82293a606ea8..67018a7c2aaef8f59d639bc629f1289b371e5db2 100644 (file)
@@ -31,14 +31,16 @@ function GetLoggedInFirst(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,13 +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 = decodeURIComponent(destination_url);
+                               window.location = 'pop';
                        }
                        else {
                                $('login_errmsg').innerHTML = ctdlresult.responseText.substr(4) ;
index 0b24ef3be6a27b19048952e2032120ddea62a97d..de071c3f1037066e015764e0d80338f8f3d4d0b7 100644 (file)
@@ -45,7 +45,7 @@ FIXME login to continue
 <input type="password" name="pass" id="pname">
 <br><br>
 </form>
-<div class="buttons"><a href="javascript:ajax_try_username_and_password('<?BSTR("destination_url", "U")>');"><?_("Log in")></a></div>
+<div class="buttons"><a href="javascript:ajax_try_username_and_password();"><?_("Log in")></a></div>
 </div>
 
 <div class="authbox" id="authbox_openid" style="display: none">
index 642565292aaa14c4b0c6269daffe1bfbf226584e..1877e445a7e11d6f5599f6f73b015fe0f0634a26 100644 (file)
@@ -472,6 +472,39 @@ void seconds_since_last_gexp(void)
 }
 
 
+/*
+ * Save a URL destination so we can go to it later
+ */
+void push_destination(void) {
+       wcsession *WCC = WC;
+
+       if (!WCC) {
+               wc_printf("no session");
+               return;
+       }
+
+       FreeStrBuf(&WCC->PushedDestination);
+       WCC->PushedDestination = NewStrBufDup(SBSTR("url"));
+       lprintf(9, "Push: %s\n", ChrPtr(WCC->PushedDestination));
+       wc_printf("OK");
+}
+
+/*
+ * Go to the URL saved by push_destination()
+ */
+void pop_destination(void) {
+       wcsession *WCC = WC;
+
+       if (!WCC) {
+               do_welcome();
+               return;
+       }
+
+       lprintf(9, "Pop: %s\n", ChrPtr(WCC->PushedDestination));
+       http_redirect(ChrPtr(WCC->PushedDestination));
+}
+
+
 
 int ReadPostData(void)
 {
@@ -878,6 +911,8 @@ InitModule_WEBCIT
        WebcitAddUrlHandler(HKEY("sslg"), "", 0, seconds_since_last_gexp, AJAX|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("ajax_servcmd"), "", 0, ajax_servcmd, 0);
        WebcitAddUrlHandler(HKEY("webcit"), "", 0, blank_page, URLNAMESPACE);
+       WebcitAddUrlHandler(HKEY("push"), "", 0, push_destination, AJAX);
+       WebcitAddUrlHandler(HKEY("pop"), "", 0, pop_destination, 0);
 
        WebcitAddUrlHandler(HKEY("401"), "", 0, authorization_required, ANONYMOUS|COOKIEUNNEEDED);
        RegisterConditional(HKEY("COND:IMPMSG"), 0, ConditionalImportantMesage, CTX_NONE);
index f518dfc1e5c23ad4c6fbf6d6e945e2b965e8a160..e7fbed419e8c4d21752d979b7a3a6facd31995e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1987-2010 by the citadel.org team
+ * Copyright (c) 1987-2011 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 858f0b61e0aee2332196023cad3b619174fae366..3a05b1b456e24ae726a3fc45a2879d7e410d82ad 100644 (file)
@@ -3,7 +3,7 @@
  * waiting on the specified port for incoming HTTP connections.  When a
  * connection is established, it calls context_loop() from context_loop.c.
  *
- * Copyright (c) 1996-2010 by the citadel.org developers.
+ * Copyright (c) 1996-2011 by the citadel.org developers.
  * This program is released under the terms of the GNU General Public License v3.
  *
  */
@@ -236,16 +236,26 @@ int main(int argc, char **argv)
 
        /* Tell 'em who's in da house */
        lprintf(1, PACKAGE_STRING "\n");
-       lprintf(1, "Copyright (C) 1996-2010 by the Citadel development team.\n"
-               "This software is distributed under the terms of the "
-               "GNU General Public License.\n\n"
-       );
-
-
-       /* initialize the International Bright Young Thing */
+       lprintf(1, "Copyright (C) 1996-2011 by the citadel.org team\n");
+       lprintf(1, "\n");
+       lprintf(1, "This program is open source  software: you can redistribute it and/or\n");
+       lprintf(1, "modify it under the terms of the GNU General Public License as published\n");
+       lprintf(1, "by the Free Software Foundation, either version 3 of the License, or\n");
+       lprintf(1, "(at your option) any later version.\n");
+       lprintf(1, "\n");
+       lprintf(1, "This program is distributed in the hope that it will be useful,\n");
+       lprintf(1, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
+       lprintf(1, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
+       lprintf(1, "GNU General Public License for more details.\n");
+       lprintf(1, "\n");
+       lprintf(1, "You should have received a copy of the GNU General Public License\n");
+       lprintf(1, "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");
+       lprintf(1, "\n");
+
+
+       /* initialize various subsystems */
 
        initialise_modules();
-
        InitTemplateCache();
        if (DumpTemplateI18NStrings) {
                FILE *fd;