X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fauth.c;h=dd97fe8d11290f2a3635fa912be2ac71aba73cb4;hb=da95759c41398bebca716daafb9cb31678eec7ee;hp=d158492df709ba3ad979d0da372688449528ccf6;hpb=f8b8d0e1cd76bd3ef30c2e925903711b400a7507;p=citadel.git diff --git a/webcit/auth.c b/webcit/auth.c index d158492df..dd97fe8d1 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -188,6 +188,7 @@ void do_login(void) { wcsession *WCC = WC; StrBuf *Buf; + long ret, rc; if (havebstr("language")) { set_selected_language(bstr("language")); @@ -202,25 +203,31 @@ void do_login(void) if (havebstr("login_action")) { serv_printf("USER %s", bstr("name")); StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) == 3) { + rc = GetServerStatus(Buf, &ret); + StrBufCutLeft(Buf, 4); + switch (rc) { + case 3: serv_printf("PASS %s", bstr("pass")); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 2) { become_logged_in(sbstr("name"), sbstr("pass"), Buf); } else { - snprintf(WCC->ImportantMessage, - sizeof (WCC->ImportantMessage), - "%s", - &(ChrPtr(Buf))[4]); + StrBufCutLeft(Buf, 4); + AppendImportantMessage(SKEY(Buf)); display_login(); FreeStrBuf(&Buf); return; } - } else { - snprintf(WCC->ImportantMessage, - sizeof (WCC->ImportantMessage), - "%s", - &(ChrPtr(Buf))[4]); + break; + case 5: + if (ret == 541) + { + AppendImportantMessage(SKEY(Buf)); + display_main_menu(); + return; + } + default: + AppendImportantMessage(SKEY(Buf)); display_login(); FreeStrBuf(&Buf); return; @@ -228,10 +235,7 @@ void do_login(void) } if (havebstr("newuser_action")) { if (!havebstr("pass")) { - snprintf(WCC->ImportantMessage, - sizeof (WCC->ImportantMessage), - "%s", - _("Blank passwords are not allowed.")); + AppendImportantMessage(_("Blank passwords are not allowed."), -1); display_login(); FreeStrBuf(&Buf); return; @@ -243,10 +247,8 @@ void do_login(void) serv_printf("SETP %s", bstr("pass")); StrBuf_ServGetln(Buf); /* Don't care? */ } else { - snprintf(WCC->ImportantMessage, - sizeof (WCC->ImportantMessage), - "%s", - &(ChrPtr(Buf))[4]); + StrBufCutLeft(Buf, 4); + AppendImportantMessage(SKEY(Buf)); display_login(); FreeStrBuf(&Buf); return; @@ -261,10 +263,7 @@ void do_login(void) do_welcome(); } } else { - snprintf(WCC->ImportantMessage, - sizeof (WCC->ImportantMessage), - "%s", - _("Your password was not accepted.")); + AppendImportantMessage(_("Your password was not accepted."), -1); display_login(); } FreeStrBuf(&Buf);