]> 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 66ae1803d03ea6239048e3f342762415eec6bad2..24fc878f0cfdaaacea1743625aeebe939bebe678 100644 (file)
@@ -34,7 +34,7 @@ void display_login(char *mesg) {
        char buf[256];
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
+       output_headers(1, "_top");
 
        /* Da banner */
        wprintf("<CENTER><TABLE border=0 width=100%><TR><TD>\n");
@@ -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);
        }
 
 
@@ -106,6 +105,12 @@ void do_login(void) {
        char buf[256];
        int need_regi = 0;
 
+
+       if (!strcasecmp(bstr("noframes"), "on"))
+               noframes = 1;
+       else
+               noframes = 0;
+
        if (!strcasecmp(bstr("action"), "Exit")) {
                do_logout();
                }
@@ -156,7 +161,7 @@ void do_login(void) {
                        display_reg(1);
                        }
                else {
-                       output_static("frameset.html");
+                       do_welcome();
                        }
                }
        else {
@@ -166,21 +171,27 @@ void do_login(void) {
        }
 
 void do_welcome(void) {
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
-       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");
+               }
        }
 
 
@@ -192,7 +203,7 @@ void do_logout(void) {
        strcpy(wc_roomname, "");
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(2);      /* note the "2" which causes cookies to be unset */
+       output_headers(2, "_top");      /* note "2" causes cookies to be unset */
 
        wprintf("<CENTER>");    
        serv_puts("MESG goodbye");
@@ -201,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);
        }
@@ -222,7 +232,7 @@ void validate(void) {
        int a;
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
+       output_headers(1, "bottom");
 
        strcpy(buf,bstr("user"));
        if (strlen(buf)>0) if (strlen(bstr("axlevel"))>0) {
@@ -237,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;
                }
 
@@ -275,7 +285,7 @@ void validate(void) {
                        urlesc(user), a, axdefs[a]);
                }
        wprintf("</TR></TABLE><CENTER><BR>\n");
-       wDumpContent();
+       wDumpContent(1);
        }
 
 
@@ -293,7 +303,7 @@ void display_reg(int during_login) {
        int a;
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
+       output_headers(1, "bottom");
 
         wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
         wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
@@ -342,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);
        }
 
 /*
@@ -373,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.");
@@ -391,7 +401,7 @@ void display_changepw(void) {
        char buf[256];
 
        printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
+       output_headers(1, "bottom");
 
         wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
         wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
@@ -411,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);
        }
 
 /*