GetLoggedInFirst() now goes directly to destination_url if already logged in
[citadel.git] / webcit / static / authmethods.js
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;