]> code.citadel.org Git - citadel.git/blobdiff - webcit/auth.c
minor HTML validation fixes, only cases, typos, superflous spaces/tabs and some ...
[citadel.git] / webcit / auth.c
index d158492df709ba3ad979d0da372688449528ccf6..2dcfaf3bb8c64a1ca1d2a90e06a309a64baa2012 100644 (file)
@@ -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);
@@ -562,7 +561,7 @@ void do_logout(void)
        /* FIXME: this is to suppress the iconbar displaying, because we aren't
           actually logged out yet */
        WCC->logged_in = 0;
-       
+
        /** Calling output_headers() this way causes the cookies to be un-set */
        output_headers(1, 1, 0, 1, 0, 0);
 
@@ -570,13 +569,13 @@ void do_logout(void)
         wc_printf("<div class=\"box\">");
         wc_printf("<div class=\"boxlabel\">");
        wc_printf(_("Log off"));
-        wc_printf("</div><div class=\"boxcontent\">"); 
+        wc_printf("</div><div class=\"boxcontent\">");
        serv_puts("MESG goodbye");
        serv_getln(buf, sizeof buf);
 
        if (WCC->serv_sock >= 0) {
                if (buf[0] == '1') {
-                       fmout("CENTER");
+                       fmout("'CENTER'");
                } else {
                        wc_printf("Goodbye\n");
                }
@@ -587,7 +586,7 @@ void do_logout(void)
                        "this problem to your system administrator.")
                );
                wc_printf("<a href=\"http://www.citadel.org/doku.php/"
-                       "faq:mastering_your_os:net#netstat\">%s</a>", 
+                       "faq:mastering_your_os:net#netstat\">%s</a>",
                        _("Read More..."));
        }
 
@@ -605,7 +604,7 @@ void do_logout(void)
        wc_printf("</a></span>");
         */
 
-       wc_printf("</div></div></div></div>\n");
+       wc_printf("</div></div></div>\n");
        wDumpContent(2);
        end_webcit_session();
 }