");
- wc_printf("
");
- wc_printf("
");
- wc_printf(_("Log off"));
- wc_printf("
");
- serv_puts("MESG goodbye");
- serv_getln(buf, sizeof buf);
-
- if (WCC->serv_sock >= 0) {
- if (buf[0] == '1') {
- fmout("'CENTER'");
- } else {
- wc_printf("Goodbye\n");
- }
- }
- else {
- wc_printf(_("This program was unable to connect or stay "
- "connected to the Citadel server. Please report "
- "this problem to your system administrator.")
- );
- wc_printf("
%s",
- _("Read More..."));
- }
-
- wc_printf("
\n");
- if (WC->serv_info->serv_supports_guest) {
+ do_template("logout");
+ if ((WCC->serv_info != NULL) && WCC->serv_info->serv_supports_guest) {
display_default_landing_page();
return;
}
@@ -735,7 +684,7 @@ void display_reg(int during_login)
Buf = NewStrBuf();
memset(&Room, 0, sizeof(folder));
if (goto_config_room(Buf, &Room) != 0) {
- syslog(9, "display_reg() exiting because goto_config_room() failed\n");
+ syslog(LOG_WARNING, "display_reg() exiting because goto_config_room() failed\n");
if (during_login) {
pop_destination();
}
@@ -751,7 +700,7 @@ void display_reg(int during_login)
FreeStrBuf(&Buf);
vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
if (vcard_msgnum < 0L) {
- syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
+ syslog(LOG_WARNING, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
if (during_login) {
pop_destination();
}
@@ -774,74 +723,17 @@ void display_reg(int during_login)
}
-
-/*
- * display form for changing your password
- */
-void display_changepw(void)
-{
- WCTemplputParams SubTP;
- char buf[SIZ];
- StrBuf *Buf;
- output_headers(1, 1, 1, 0, 0, 0);
-
- Buf = NewStrBufPlain(_("Change your password"), -1);
- memset(&SubTP, 0, sizeof(WCTemplputParams));
- SubTP.Filter.ContextType = CTX_STRBUF;
- SubTP.Context = Buf;
- DoTemplate(HKEY("box_begin"), NULL, &SubTP);
-
- FreeStrBuf(&Buf);
-
- if (!IsEmptyStr(WC->ImportantMessage)) {
- wc_printf("
"
- "%s\n", WC->ImportantMessage);
- safestrncpy(WC->ImportantMessage, "", sizeof WC->ImportantMessage);
- }
-
- serv_puts("MESG changepw");
- serv_getln(buf, sizeof buf);
- if (buf[0] == '1') {
- fmout("CENTER");
- }
-
- wc_printf("
\n");
-
- do_template("box_end");
- wDumpContent(1);
-}
-
/*
* change password
* if passwords match, propagate it to citserver.
*/
void changepw(void)
{
- char buf[SIZ];
+ StrBuf *Line;
char newpass1[32], newpass2[32];
if (!havebstr("change_action")) {
- safestrncpy(WC->ImportantMessage,
- _("Cancelled. Password was not changed."),
- sizeof WC->ImportantMessage);
+ AppendImportantMessage(_("Cancelled. Password was not changed."), -1);
display_main_menu();
return;
}
@@ -850,36 +742,37 @@ void changepw(void)
safestrncpy(newpass2, bstr("newpass2"), sizeof newpass2);
if (strcasecmp(newpass1, newpass2)) {
- safestrncpy(WC->ImportantMessage,
- _("They don't match. Password was not changed."),
- sizeof WC->ImportantMessage);
- display_changepw();
+ AppendImportantMessage(_("They don't match. Password was not changed."), -1);
+ do_template("menu_change_pw");
return;
}
if (IsEmptyStr(newpass1)) {
- safestrncpy(WC->ImportantMessage,
- _("Blank passwords are not allowed."),
- sizeof WC->ImportantMessage);
- display_changepw();
+ AppendImportantMessage(_("Blank passwords are not allowed."), -1);
+ do_template("menu_change_pw");
return;
}
+ Line = NewStrBuf();
serv_printf("SETP %s", newpass1);
- serv_getln(buf, sizeof buf);
- sprintf(WC->ImportantMessage, "%s", &buf[4]);
- if (buf[0] == '2') {
+ StrBuf_ServGetln(Line);
+ if (GetServerStatusMsg(Line, NULL, 1, 0) == 2) {
if (WC->wc_password == NULL)
- WC->wc_password = NewStrBufPlain(buf, -1);
+ WC->wc_password = NewStrBufPlain(
+ ChrPtr(Line) + 4,
+ StrLength(Line) - 4);
else {
FlushStrBuf(WC->wc_password);
- StrBufAppendBufPlain(WC->wc_password, buf, -1, 0);
+ StrBufAppendBufPlain(WC->wc_password,
+ ChrPtr(Line) + 4,
+ StrLength(Line) - 4, 0);
}
display_main_menu();
}
else {
- display_changepw();
+ do_template("menu_change_pw");
}
+ FreeStrBuf(&Line);
}
@@ -942,7 +835,7 @@ void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
hdr->HR.got_auth = AUTH_BASIC;
}
else
- syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
+ syslog(LOG_WARNING, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
}
}
@@ -956,11 +849,6 @@ void CheckAuthBasic(ParsedHttpHdrs *hdr)
*/
StrBufAppendBufPlain(hdr->HR.plainauth, HKEY(":"), 0);
StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
- hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
-/*
- syslog(1, "CheckAuthBasic: calculated sessionkey %ld\n",
- hdr->HR.SessionKey);
-*/
}
@@ -1054,7 +942,6 @@ InitModule_AUTH
WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
WebcitAddUrlHandler(HKEY("do_welcome"), "", 0, do_welcome, 0);
WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
- WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
@@ -1062,9 +949,9 @@ InitModule_AUTH
WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0, ajax_login_username_password, AJAX|ANONYMOUS);
WebcitAddUrlHandler(HKEY("ajax_login_newuser"), "", 0, ajax_login_newuser, AJAX|ANONYMOUS);
WebcitAddUrlHandler(HKEY("switch_language"), "", 0, switch_language, ANONYMOUS);
- RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
- RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
- RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
+ RegisterConditional("COND:AIDE", 2, ConditionalAide, CTX_NONE);
+ RegisterConditional("COND:LOGGEDIN", 2, ConditionalIsLoggedIn, CTX_NONE);
+ RegisterConditional("COND:MAY_CREATE_ROOM", 2, ConditionalHaveAccessCreateRoom, CTX_NONE);
return;
}