* Display the login screen
* mesg = the error message if last attempt failed.
*/
-void display_login(char *mesg)
+void display_login(void)
{
- char buf[SIZ];
-
- output_headers(1, 1, 2, 0, 0, 0);
- wprintf("<div id=\"login_screen\">\n");
-
- if ((mesg != NULL) && (!IsEmptyStr(mesg))) {
- stresc(buf, SIZ, mesg, 0, 0);
- svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
- }
-
- svprintf(HKEY("LOGIN_INSTRUCTIONS"), WCS_STRING,
- _("<ul>"
- "<li><b>If you already have an account on %s</b>, "
- "enter your user name and password and click "Login." "
- "<li><b>If you are a new user</b>, enter the name and password "
- "you wish to use, "
- "and click "New User." "
- "<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>"),
- serv_info.serv_humannode
- );
-
- svput("USERNAME_BOX", WCS_STRING, _("User name:"));
- svput("PASSWORD_BOX", WCS_STRING, _("Password:"));
- svput("LANGUAGE_BOX", WCS_STRING, _("Language:"));
- svput("LOGIN_BUTTON", WCS_STRING, _("Login"));
- svput("NEWUSER_BUTTON", WCS_STRING, _("New User"));
- 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);
- if (serv_info.serv_newuser_disabled) {
- svput("NEWUSER_BUTTON_PRE", WCS_STRING, "<div style=\"display:none;\">");
- svput("NEWUSER_BUTTON_POST", WCS_STRING, "</div>");
- }
- else {
- svput("NEWUSER_BUTTON_PRE", WCS_STRING, "");
- svput("NEWUSER_BUTTON_POST", WCS_STRING, "");
- }
-
- if (serv_info.serv_supports_openid) {
- svprintf(HKEY("OFFER_OPENID_LOGIN"), WCS_STRING,
- "<div align=center>"
- "<a href=\"display_openid_login\">"
- "<img src=\"static/openid-small.gif\" border=0 valign=middle>"
- "%s</a>"
- "</div>"
- ,
- "Log in using OpenID"
- );
- }
- else {
- svput("OFFER_OPENID_LOGIN", WCS_STRING, "");
- }
-
+ begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
do_template("login", NULL);
-
- wDumpContent(2);
+ end_burst();
}
"</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);
-
+
svprintf(HKEY("OFFER_CONVENTIONAL_LOGIN"), WCS_STRING,
"<div align=center>"
"<a href=\"display_login\">"
*/
void do_login(void)
{
+ struct wcsession *WCC = WC;
char buf[SIZ];
if (havebstr("language")) {
if (buf[0] == '2') {
become_logged_in(bstr("name"), bstr("pass"), buf);
} else {
- display_login(&buf[4]);
+ snprintf(WCC->ImportantMessage,
+ sizeof (WCC->ImportantMessage),
+ "%s",
+ &buf[4]);
+ display_login();
return;
}
} else {
- display_login(&buf[4]);
+ snprintf(WCC->ImportantMessage,
+ sizeof (WCC->ImportantMessage),
+ "%s",
+ &buf[4]);
+ display_login();
return;
}
}
if (havebstr("newuser_action")) {
if (!havebstr("pass")) {
- display_login(_("Blank passwords are not allowed."));
+ snprintf(WCC->ImportantMessage,
+ sizeof (WCC->ImportantMessage),
+ "%s",
+ _("Blank passwords are not allowed."));
+ display_login();
return;
}
serv_printf("NEWU %s", bstr("name"));
serv_printf("SETP %s", bstr("pass"));
serv_getln(buf, sizeof buf);
} else {
- display_login(&buf[4]);
+ snprintf(WCC->ImportantMessage,
+ sizeof (WCC->ImportantMessage),
+ "%s",
+ &buf[4]);
+ display_login();
return;
}
}
- if (WC->logged_in) {
+ if (WCC->logged_in) {
set_preference("language", NewStrBufPlain(bstr("language"), -1), 1);
- if (WC->need_regi) {
+ if (WCC->need_regi) {
display_reg(1);
- } else if (WC->need_vali) {
+ } else if (WCC->need_vali) {
validate();
} else {
do_welcome();
}
} else {
- display_login(_("Your password was not accepted."));
+ snprintf(WCC->ImportantMessage,
+ sizeof (WCC->ImportantMessage),
+ "%s",
+ _("Your password was not accepted."));
+ display_login();
}
}
* depending on the browser locale change the sequence of the
* language chooser.
*/
-void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) {
+void tmplput_offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) {
int i;
#ifndef HAVE_USELOCALE
char *Lang = getenv("LANG");
#else /* ENABLE_NLS */
/** \brief dummy for non NLS enabled systems */
-void offer_languages(void) {
+void tmplput_offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) {
wprintf("English (US)");
}
#endif
}
-
+void
+InitModule_GETTEXT
+(void)
+{
+ RegisterNamespace("LANG:SELECT", 0, 0, tmplput_offer_languages, CTX_NONE);
+}
long len;
int intext = 0;
- StrBufAppendPrintf(Target, "<div align=%s>\n", align);
+ StrBufAppendPrintf(Target, "<div align=\"%s\">\n", align);
while ((n = StrBufSipLine(Line, Source, &BufPtr), n >= 0) && !done)
{
done = n == 0;
StrEscAppend(Target, NULL, serv_info.serv_fqdn, 0, 0);
}
-void tmmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+void tmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_software, 0, 0);
}
serv_info.serv_rev_level / 100,
serv_info.serv_rev_level % 100);
}
+int conditional_serv_newuser_disabled(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ return serv_info.serv_newuser_disabled != 0;
+}
+int conditional_serv_supports_openid(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ return serv_info.serv_supports_openid != 0;
+}
-void tmmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+void tmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_bbs_city, 0, 0);
}
}
+void tmplput_mesg(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ int n = 0;
+ int Done = 0;
+ StrBuf *Line;
+ StrBuf *Buf;
-
+ Buf = NewStrBuf();
+ Line = NewStrBuf();
+ serv_printf("MESG %s", Tokens->Params[0]->Start);
+ StrBuf_ServGetln(Line);
+ while (!Done && (StrBuf_ServGetln(Line)>=0)) {
+ if ( (StrLength(Line)==3) &&
+ !strcmp(ChrPtr(Line), "000"))
+ Done = 1;
+ else
+ {
+ if (n > 0)
+ StrBufAppendBufPlain(Buf, "\n", 1, 0);
+ StrBufAppendBuf(Buf, Line, 0);
+ }
+ n++;
+ }
+ FlushStrBuf(Line);
+ FmOut(Line, "center", Buf);
+ StrBufAppendTemplate(Target, nArgs, Tokens, Context, ContextType, Line, 1);
+ FreeStrBuf(&Buf);
+ FreeStrBuf(&Line);
+}
void
InitModule_SERVFUNC
(void)
{
+
+ RegisterConditional(HKEY("COND:SERV:OPENID"), 2, conditional_serv_supports_openid, CTX_NONE);
+ RegisterConditional(HKEY("COND:SERV:NEWU"), 2, conditional_serv_newuser_disabled, CTX_NONE);
RegisterNamespace("CURRENT_USER", 0, 0, tmplput_current_user, CTX_NONE);
RegisterNamespace("CURRENT_ROOM", 0, 0, tmplput_current_room, CTX_NONE);
RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, CTX_NONE);
RegisterNamespace("SERV:NODENAME", 0, 0, tmplput_serv_nodename, CTX_NONE);
RegisterNamespace("SERV:HUMANNODE", 0, 0, tmplput_serv_humannode, CTX_NONE);
RegisterNamespace("SERV:FQDN", 0, 0, tmplput_serv_fqdn, CTX_NONE);
- RegisterNamespace("SERV:SOFTWARE", 0, 0, tmmplput_serv_software, CTX_NONE);
+ RegisterNamespace("SERV:SOFTWARE", 0, 0, tmplput_serv_software, CTX_NONE);
RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, CTX_NONE);
- RegisterNamespace("SERV:BBS_CITY", 0, 0, tmmplput_serv_bbs_city, CTX_NONE);
-/// RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmmplput_serv_ldap_enabled, 0);
+ RegisterNamespace("SERV:BBS_CITY", 0, 0, tmplput_serv_bbs_city, CTX_NONE);
+ RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, CTX_NONE);
+/// RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmplput_serv_ldap_enabled, 0);
}
/*@}*/
-<?=("beginbox")>
-<?HELLO>
-<div class="login_message"><?MESG></div>
+<?=("head")>
+<div id="login_screen">
+<div class="box">
+<div class="boxlabel"><?SERV:HUMANNODE> - <?_("powered by")> <a href="http://www.citadel.org">Citadel</a></div>
+<div class="boxcontent">
+<?SERV:MESG("hello")>
+
+<?!("COND:IMPMSG", 1)>
+<?IMPORTANTMESSAGE>
+<?!("X", 1)>
+
+<div class="login_message"></div>
<form action="login" method="POST" class="box" id="login_form">
- <label for="uname"><?USERNAME_BOX></label>
+ <label for="uname"><?_("User name:")></label>
<input type="text" name="name" id="uname" > <br>
- <label for="pname"><?PASSWORD_BOX></label>
+ <label for="pname"><?_("Password:")></label>
<input type="password" name="pass" id="pname" > <br>
- <label for="lname"><?LANGUAGE_BOX></label>
- <?DO_LANGUAGE_BOX> <br>
+ <label for="lname"><?_("Language:")></label>
+ <?LANG:SELECT> <br>
<div class="logbuttons">
- <input type="submit" name="login_action" value="<?LOGIN_BUTTON>" class="logbutton">
- <?NEWUSER_BUTTON_PRE>
- <input type="submit" name="newuser_action" value="<?NEWUSER_BUTTON>" class="logbutton" >
- <?NEWUSER_BUTTON_POST>
- <input type="submit" name="exit_action" value="<?EXIT_BUTTON>" class="logbutton">
+ <input type="submit" name="login_action" value="<?_("Login")>" class="logbutton">
+ <??("COND:SERV:NEWU", 1)>
+ <div style="display:none;">
+ <input type="submit" name="newuser_action" value="<?_("New User")>" class="logbutton" >
+ </div>
+ <??("X", 1)>
+ <input type="submit" name="exit_action" value="<?_("Exit")>" class="logbutton">
<br>
</div>
</form>
-<?OFFER_OPENID_LOGIN>
+<??("COND:SERV:OPENID", 3)>
+ <div align=center>
+ <a href="display_openid_login">
+ <img src="static/openid-small.gif" border="0" valign="middle">
+ <?_("Log in using OpenID")></a>
+ </div>
+<??("X", 3)>
<div class="login_image"><img src="image&name=hello"></div>
-<div class="login_infos"><?LOGIN_INSTRUCTIONS></div>
+<div class="login_infos">
+<ul><li><b><?_("If you already have an account on")> <?SERV:HUMANNODE></b>,
+<?_("enter your user name and password and click "Login."<li><b>If you are a new user</b>, enter the name and password you wish to use, and click "New User." <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>
+
+</div>
<?=("endbox")>
+<?=("trailing")>
<div class="message_header">
<span><?MAIL:SUMM:DATESTR></span>
<span><?_("from ")>
- <??("COND:MAIL:ANON",1)><?MAIL:SUMM:FROM("X")><<?MAIL:SUMM:RFCA("X")>><??("X", 1)>
+ <??("COND:MAIL:ANON",1)><?MAIL:SUMM:FROM("X")> <<?MAIL:SUMM:RFCA("X")>><??("X", 1)>
<?!("COND:MAIL:ANON",2)>***<??("X", 2)>
</span>
<p class="message_subject"><?MAIL:SUMM:SUBJECT></p>
void locate_host(char *, int);
void become_logged_in(char *, char *, char *);
void openid_manual_create(void);
-void display_login(char *mesg);
+void display_login();
void display_openids(void);
void do_welcome(void);
void do_logout(void);