GetLoggedInFirst() now goes directly to destination_url if already logged in
authorArt Cancro <ajc@citadel.org>
Mon, 3 Jan 2011 21:28:36 +0000 (16:28 -0500)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 13:39:21 +0000 (13:39 +0000)
webcit/auth.c
webcit/static/authmethods.js
webcit/static/t/head.html

index 9373d19a4249e3c5c3dad3f4af90af711a104acf..653f0a3d6ca22217cf61c55925e56b71b05e3cf3 100644 (file)
@@ -950,6 +950,7 @@ int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP)
 {
        wcsession *WCC = WC;
        return (WCC != NULL)? (WCC->logged_in == 0) : 0;
+
 }
 
 
index 2665351769404e5a6da0b07345dce72a64c506d8..57550687a0f177cd6a90f2dcd339337113e2a747 100644 (file)
@@ -6,13 +6,30 @@
  */
 
 
+/*
+ * Are we logged in right now?
+ */
+function IsLoggedIn() {
+       if ($('is_logged_in').innerHTML == "yes") {
+               return 1;
+       }
+       else {
+               return 0;
+       }
+}
+
+
+
 /*
  * Wrapper script to require logging in before completing an action
  */
 function GetLoggedInFirst(destination_url) {
 
        /* If logged in already, go directly to the destination. */
-       /* FIXME implement this */
+       if (IsLoggedIn()) {
+               window.location = destination_url;
+               return;
+       }
 
        /* 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;
index 60d1053c13c41b05b884a25585c1378547f4c65d..ae9e3f74f9ba9024e5b5db47609cef3d9f4d25f3 100644 (file)
@@ -26,7 +26,8 @@
                <script type="text/javascript" src="static/modal.js"></script>
        </head>
 <body>
-       <?ICONBAR>
+<div id="is_logged_in" style="display:none"><?%("COND:LOGGEDIN", 1, 1, 1, "no", "yes")></div>
+<?ICONBAR>
 <!--("begin modal container")-->
 <div id="modal">
        <div class="md-overlay-decorator"></div>