Get the login screen ready for OpenID support
authorArt Cancro <ajc@citadel.org>
Thu, 15 May 2008 04:27:24 +0000 (04:27 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 15 May 2008 04:27:24 +0000 (04:27 +0000)
webcit/auth.c
webcit/static/login.html
webcit/static/openid-small.gif [new file with mode: 0644]
webcit/static/openid_login.html [new file with mode: 0644]
webcit/static/webcit.css
webcit/webcit.c
webcit/webcit.h

index a057e5877cd7ddfb538eff467e3a4175c1c45c32..5a0d14595946be77f85ef727d651c405d26f5cef 100644 (file)
@@ -78,6 +78,14 @@ void display_login(char *mesg)
                svput("NEWUSER_BUTTON_POST", WCS_STRING, "");
        }
 
+#ifdef TECH_PREVIEW
+               svprintf(HKEY("OFFER_OPENID_LOGIN"), WCS_STRING, "<a href=\"display_openid_login\">%s</a>",
+                       "Click here to login with OpenID"       // FIXME localize when ready
+               );
+#else
+               svput("OFFER_OPENID_LOGIN", WCS_STRING, "");
+#endif
+
        do_template("login");
 
        wDumpContent(2);
@@ -86,6 +94,50 @@ void display_login(char *mesg)
 
 
 
+/* 
+ * Display the openid-enabled login screen
+ * mesg = the error message if last attempt failed.
+ */
+void display_openid_login(char *mesg)
+{
+       char buf[SIZ];
+
+       output_headers(1, 1, 2, 0, 0, 0);
+       wprintf("<div id=\"login_screen\">\n");
+
+       if (mesg != NULL) if (!IsEmptyStr(mesg)) {
+                       stresc(buf, SIZ,  mesg, 0, 0);
+                       svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
+       }
+
+       svprintf(HKEY("LOGIN_INSTRUCTIONS"), WCS_STRING,
+               _("<ul>"
+               "<li>Enter your OpenID URL and click &quot;Login&quot;."
+               "<li>Please log off properly when finished. "
+               "<li>You must use a browser that supports <i>frames</i> and "
+               "<i>cookies</i>. "
+               "<li>Also keep in mind that if your browser is "
+               "configured to block pop-up windows, you will not be able "
+               "to receive any instant messages.<br />"
+               "</ul>")
+       );
+
+       svput("OPENID_BOX", WCS_STRING, _("OpenID URL:"));
+       svput("LANGUAGE_BOX", WCS_STRING, _("Language:"));
+       svput("LOGIN_BUTTON", WCS_STRING, _("Login"));
+       svput("EXIT_BUTTON", WCS_STRING, _("Exit"));
+       svput("HELLO", WCS_SERVCMD, "MESG hello");
+       svprintf(HKEY("BOXTITLE"), WCS_STRING, _("%s - powered by <a href=\"http://www.citadel.org\">Citadel</a>"),
+               serv_info.serv_humannode);
+       svcallback("DO_LANGUAGE_BOX", offer_languages);
+
+       do_template("openid_login");
+       wDumpContent(2);
+}
+
+
+
+
 /* Initialize the session
  *
  * This function needs to get called whenever the session changes from
index ce26eafaf89a8c639edaa34f9e5ded75a9c7a92a..2307562ffe7bbe10292183cc3ad27fba0227d5c5 100644 (file)
@@ -17,6 +17,7 @@
         <br>
         </div>
 </form>
+<?OFFER_OPENID_LOGIN>
 <div class="login_image"><img src="image&name=hello"></div>
 <div class="login_infos"><?LOGIN_INSTRUCTIONS></div>
 <?=endbox>
diff --git a/webcit/static/openid-small.gif b/webcit/static/openid-small.gif
new file mode 100644 (file)
index 0000000..cde836c
Binary files /dev/null and b/webcit/static/openid-small.gif differ
diff --git a/webcit/static/openid_login.html b/webcit/static/openid_login.html
new file mode 100644 (file)
index 0000000..f28dfad
--- /dev/null
@@ -0,0 +1,17 @@
+<?=beginbox>
+<?HELLO>
+<div class="login_message"><?MESG></div>
+<form action="openid_login" method="POST"  class="box" id="login_form">
+        <label for="uname"><?OPENID_BOX></label>
+        <input type="text" name="openid_url" id="uname" class="openid_urlarea"> <br>
+        <label for="lname"><?LANGUAGE_BOX></label>
+        <?DO_LANGUAGE_BOX> <br>
+        <div class="logbuttons">
+        <input type="submit" name="login_action" value="<?LOGIN_BUTTON>" class="logbutton">
+        <input type="submit" name="exit_action" value="<?EXIT_BUTTON>"  class="logbutton">
+        <br>
+        </div>
+</form>
+<div class="login_image"><img src="image&name=hello"></div>
+<div class="login_infos"><?LOGIN_INSTRUCTIONS></div>
+<?=endbox>
index 69f32a98f647bf40e01f782bbba9d1711397ab40..8f07e72f7572d38f9ea596d6b5e3bb0b0155b189 100644 (file)
@@ -1392,3 +1392,8 @@ li.event_unread span, a.event_read_title {
        width: 16px;
        height: 16px;
 }
+
+.openid_urlarea {
+       background: url('openid-small.gif') no-repeat scroll 0pt 50%;
+       padding-left: 18px;
+}
index d16258f748fe7690d2c8d265bca25e274ae3ac60..0ff603070d0d2332e00485e7328a6e7d0069fb52 100644 (file)
@@ -1709,17 +1709,19 @@ void session_loop(struct httprequest *req)
        } else if (!strcasecmp(action, "display_mime_icon")) {
                display_mime_icon();
 
-               /**
-                * All functions handled below this point ... make sure we log in
-                * before doing anything else!
-                */
+       /*
+        * All functions handled below this point ... make sure we log in
+        * before doing anything else!
+        */
        } else if ((!WC->logged_in) && (!strcasecmp(action, "login"))) {
                do_login();
+       } else if ((!WC->logged_in) && (!strcasecmp(action, "display_openid_login"))) {
+               display_openid_login(NULL);
        } else if (!WC->logged_in) {
                display_login(NULL);
        }
 
-       /**
+       /*
         * Various commands...
         */
 
index 6f123d5a6ff78ce7ca939027128a2e17ee62bd93..21cd14e35dd3afd82b65c40c2e930d9243a126f9 100644 (file)
@@ -485,6 +485,7 @@ void locate_host(char *, int);
 void become_logged_in(char *, char *, char *);
 void do_login(void);
 void display_login(char *mesg);
+void display_openid_login(char *mesg);
 void do_welcome(void);
 void do_logout(void);
 void display_main_menu(void);