]> code.citadel.org Git - citadel.git/blobdiff - webcit/auth.c
* Started moving all of the global variables into a struct, to facilitate
[citadel.git] / webcit / auth.c
index 184c04cf84b5477d69d442f610f794a1b79cca1d..28d89efba3319e3e89520b954307fb8c47002afc 100644 (file)
@@ -36,7 +36,7 @@ void display_login(char *mesg)
        char buf[256];
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "_top");
+       output_headers(3);
 
        /* Da banner */
        wprintf("<CENTER><TABLE border=0 width=100%><TR><TD>\n");
@@ -68,15 +68,6 @@ void display_login(char *mesg)
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"New User\">\n");
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Exit\">\n");
 
-       /* Only offer the "check to disable frames" selection if frames haven't
-        * already been disabled by the browser braindamage check.
-        */
-       if (noframes == 0) {
-               wprintf("<BR><INPUT TYPE=\"checkbox\" NAME=\"noframes\">");
-               wprintf("<FONT SIZE=-1>&nbsp;Check here to disable frames</FONT>\n");
-               wprintf("</FORM></CENTER>\n");
-       }
-
        /* Da instructions */
        wprintf("<LI><EM>If you already have an account on %s,",
                serv_info.serv_humannode);
@@ -89,7 +80,7 @@ void display_login(char *mesg)
        wprintf("<LI>You must use a browser that supports <i>cookies</i>.<BR>\n");
        wprintf("</EM></UL>\n");
 
-       wDumpContent(1);
+       wDumpContent(0);        /* No menu here; not logged in yet! */
 }
 
 
@@ -100,12 +91,12 @@ void display_login(char *mesg)
  */
 void become_logged_in(char *user, char *pass, char *serv_response)
 {
-       logged_in = 1;
-       extract(wc_username, &serv_response[4], 0);
-       strcpy(wc_password, pass);
-       axlevel = extract_int(&serv_response[4], 1);
-       if (axlevel >= 6)
-               is_aide = 1;
+       WC->logged_in = 1;
+       extract(WC->wc_username, &serv_response[4], 0);
+       strcpy(WC->wc_password, pass);
+       WC->axlevel = extract_int(&serv_response[4], 1);
+       if (WC->axlevel >= 6)
+               WC->is_aide = 1;
 }
 
 
@@ -115,12 +106,6 @@ void do_login(void)
        int need_regi = 0;
 
 
-       /* Note that the initial value of noframes is set by the browser braindamage
-        * check, so don't add an "else" clause here.
-        */
-       if (!strcasecmp(bstr("noframes"), "on"))
-               noframes = 1;
-
        if (!strcasecmp(bstr("action"), "Exit")) {
                do_logout();
        }
@@ -154,12 +139,13 @@ void do_login(void)
                        return;
                }
        }
-       if (logged_in) {
+       if (WC->logged_in) {
                serv_puts("CHEK");
                serv_gets(buf);
                if (buf[0] == '2') {
+                       WC->new_mail = extract_int(&buf[4], 0);
                        need_regi = extract_int(&buf[4], 1);
-                       /* FIX also check for new mail etc. here */
+                       WC->need_vali = extract_int(&buf[4], 2);
                }
                if (need_regi) {
                        display_reg(1);
@@ -174,18 +160,7 @@ void do_login(void)
 
 void do_welcome(void)
 {
-
-       if (noframes) {
-               printf("HTTP/1.0 200 OK\n");
-               output_headers(1, "_top");
-               wprintf("<CENTER><H1>");
-               escputs(wc_username);
-               wprintf("</H1>\n");
-               /* FIX add user stats here */
-               wDumpContent(1);
-       } else {
-               output_static("frameset.html");
-       }
+       smart_goto("_BASEROOM_");
 }
 
 
@@ -193,12 +168,12 @@ void do_logout(void)
 {
        char buf[256];
 
-       strcpy(wc_username, "");
-       strcpy(wc_password, "");
-       strcpy(wc_roomname, "");
+       strcpy(WC->wc_username, "");
+       strcpy(WC->wc_password, "");
+       strcpy(WC->wc_roomname, "");
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(2, "_top");      /* note "2" causes cookies to be unset */
+       output_headers(2);      /* note "2" causes cookies to be unset */
 
        wprintf("<CENTER>");
        serv_puts("MESG goodbye");
@@ -230,12 +205,12 @@ void validate(void)
        int a;
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
 
        strcpy(buf, bstr("user"));
        if (strlen(buf) > 0)
-               if (strlen(bstr("axlevel")) > 0) {
-                       serv_printf("VALI %s|%s", buf, bstr("axlevel"));
+               if (strlen(bstr("WC->axlevel")) > 0) {
+                       serv_printf("VALI %s|%s", buf, bstr("WC->axlevel"));
                        serv_gets(buf);
                        if (buf[0] != '2') {
                                wprintf("<EM>%s</EM><BR>\n", &buf[4]);
@@ -286,7 +261,7 @@ void validate(void)
        wprintf("</CAPTION><TR>");
        for (a = 0; a <= 6; ++a) {
                wprintf(
-                              "<TD><A HREF=\"/validate&user=%s&axlevel=%d\">%s</A></TD>\n",
+                              "<TD><A HREF=\"/validate&user=%s&WC->axlevel=%d\">%s</A></TD>\n",
                               urlesc(user), a, axdefs[a]);
        }
        wprintf("</TR></TABLE><CENTER><BR>\n");
@@ -309,7 +284,7 @@ void display_reg(int during_login)
        int a;
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
 
        wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
        wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
@@ -355,7 +330,7 @@ void display_reg(int during_login)
                        case 8:
                                wprintf("Telephone:</TD><TD><INPUT TYPE=\"text\" NAME=\"phone\" VALUE=\"%s\" MAXLENGTH=\"14\"><BR>\n", buf);
                                break;
-                       case 9:
+                       case 10:
                                wprintf("E-Mail:</TD><TD><INPUT TYPE=\"text\" NAME=\"email\" VALUE=\"%s\" MAXLENGTH=\"31\"><BR>\n", buf);
                                break;
                        }
@@ -413,7 +388,7 @@ void display_changepw(void)
        char buf[256];
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
+       output_headers(1);
 
        wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
        wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");