]> code.citadel.org Git - citadel.git/blobdiff - webcit/auth.c
* wDumpContent() is now responsible for </BODY></HTML> most of the
[citadel.git] / webcit / auth.c
index f07128787426fc60933c597f6afca2229c1d5e42..24fc878f0cfdaaacea1743625aeebe939bebe678 100644 (file)
@@ -83,8 +83,7 @@ void display_login(char *mesg) {
        wprintf("and <i>cookies</i>.\n");
        wprintf("</EM></UL>\n");
 
-       wprintf("</BODY></HTML>\n");
-       wDumpContent();
+       wDumpContent(1);
        }
 
 
@@ -107,7 +106,10 @@ void do_login(void) {
        int need_regi = 0;
 
 
-       if (!strcasecmp(bstr("noframes"), "on")) noframes = 1;
+       if (!strcasecmp(bstr("noframes"), "on"))
+               noframes = 1;
+       else
+               noframes = 0;
 
        if (!strcasecmp(bstr("action"), "Exit")) {
                do_logout();
@@ -159,7 +161,7 @@ void do_login(void) {
                        display_reg(1);
                        }
                else {
-                       output_static("frameset.html");
+                       do_welcome();
                        }
                }
        else {
@@ -169,21 +171,27 @@ void do_login(void) {
        }
 
 void do_welcome(void) {
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1, "bottom");
-       wprintf("<CENTER><H1>");
-       escputs(wc_username);
-       wprintf("</H1>\n");
-       /* FIX add user stats here */
-
-       wprintf("<HR>");
-       /* FIX  ---  what should we put here?  the main menu,
-        * or new messages in the lobby?
-        */
-       embed_main_menu();
-
-       wprintf("</BODY></HTML>\n");
-       wDumpContent();
+
+
+       fprintf(stderr, "DO_WELCOME CALLED, NOFRAMES=%d\n", noframes);
+
+       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 */
+       
+               wprintf("<HR>");
+               embed_main_menu();
+       
+               wDumpContent(1);
+               }
+
+       else {
+               output_static("frameset.html");
+               }
        }
 
 
@@ -204,9 +212,8 @@ void do_logout(void) {
        if (buf[0]=='1') fmout(NULL);
        else wprintf("Goodbye\n");
 
-       wprintf("<HR><A HREF=\"/\">Log in again</A>\n");
-       wprintf("</CENTER></BODY></HTML>\n");
-       wDumpContent();
+       wprintf("<HR><A HREF=\"/\">Log in again</A></CENTER>\n");
+       wDumpContent(1);
        serv_puts("QUIT");
        exit(0);
        }
@@ -240,8 +247,8 @@ void validate(void) {
        serv_gets(buf);
 
        if (buf[0]!='3') {
-               wprintf("<EM>%s</EM><BR></BODY></HTML>\n", &buf[4]);
-               wDumpContent();
+               wprintf("<EM>%s</EM><BR>\n", &buf[4]);
+               wDumpContent(1);
                return;
                }
 
@@ -278,7 +285,7 @@ void validate(void) {
                        urlesc(user), a, axdefs[a]);
                }
        wprintf("</TR></TABLE><CENTER><BR>\n");
-       wDumpContent();
+       wDumpContent(1);
        }
 
 
@@ -345,8 +352,8 @@ void display_reg(int during_login) {
                }
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Register\">\n");
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Cancel\">\n");
-       wprintf("</CENTER></BODY></HTML>\n");
-       wDumpContent();
+       wprintf("</CENTER>\n");
+       wDumpContent(1);
        }
 
 /*
@@ -376,7 +383,7 @@ void register_user(void) {
        serv_puts("000");
        
        if (atoi(bstr("during_login"))) {
-               output_static("frameset.html");
+               do_welcome();
                }
        else {
                display_error("Registration information has been saved.");
@@ -414,8 +421,8 @@ void display_changepw(void) {
        wprintf("</TABLE>\n");  
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Change\">\n");
        wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Cancel\">\n");
-       wprintf("</CENTER></BODY></HTML>\n");
-       wDumpContent();
+       wprintf("</CENTER>\n");
+       wDumpContent(1);
        }
 
 /*