From 1bc9ac3216ae35bb1470838e8613ddf544923e87 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 15 May 2008 04:27:24 +0000 Subject: [PATCH] Get the login screen ready for OpenID support --- webcit/auth.c | 52 ++++++++++++++++++++++++++++++++ webcit/static/login.html | 1 + webcit/static/openid-small.gif | Bin 0 -> 237 bytes webcit/static/openid_login.html | 17 +++++++++++ webcit/static/webcit.css | 5 +++ webcit/webcit.c | 12 +++++--- webcit/webcit.h | 1 + 7 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 webcit/static/openid-small.gif create mode 100644 webcit/static/openid_login.html diff --git a/webcit/auth.c b/webcit/auth.c index a057e5877..5a0d14595 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -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, "%s", + "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("
\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, + _("") + ); + + 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 Citadel"), + 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 diff --git a/webcit/static/login.html b/webcit/static/login.html index ce26eafaf..2307562ff 100644 --- a/webcit/static/login.html +++ b/webcit/static/login.html @@ -17,6 +17,7 @@
+
diff --git a/webcit/static/openid-small.gif b/webcit/static/openid-small.gif new file mode 100644 index 0000000000000000000000000000000000000000..cde836c893f64bcfec04b9c817e3371ff122fe19 GIT binary patch literal 237 zcmVb{bmUKcqz}))c5uC(7v?)v4a2P)ZNa- z@$&T2)z|&~{r~^}A^8LV00000EC2ui01yBW000GQ;3tk`X`bk)Wk@<6#nZYULKH{p zEx|?+kif!I0vIL|#ZMubBmjWH2OtmxIFVa~6JQ7!1CK!f5W#StOTv&C3=E8h2vI1s n+#cd5;2fT3B_0kF0v!+!GARoV78n&7dMN`JIW(4+BOw4gP{MS* literal 0 HcmV?d00001 diff --git a/webcit/static/openid_login.html b/webcit/static/openid_login.html new file mode 100644 index 000000000..f28dfad66 --- /dev/null +++ b/webcit/static/openid_login.html @@ -0,0 +1,17 @@ + + + +
+ +
+ +
+
+ + +
+
+
+ + + diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index 69f32a98f..8f07e72f7 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -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; +} diff --git a/webcit/webcit.c b/webcit/webcit.c index d16258f74..0ff603070 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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... */ diff --git a/webcit/webcit.h b/webcit/webcit.h index 6f123d5a6..21cd14e35 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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); -- 2.39.2