4 * This file contains code which relates to authentication of users to Citadel.
19 * Display the login screen
21 void display_login() {
24 printf("HTTP/1.0 200 OK\n");
27 wprintf("<HTML><BODY>\n");
28 wprintf("<CENTER><TABLE border=0><TR><TD>\n");
30 /* FIX replace with the correct image */
31 wprintf("<IMG SRC=\"/static/velma.gif\">");
32 wprintf("</TD><TD><CENTER>\n");
34 serv_puts("MESG hello");
36 if (buf[0]=='1') fmout(NULL);
38 wprintf("</CENTER></TD></TR></TABLE></CENTER>\n");
41 /* FIX add instructions here */
42 wprintf("<CENTER><FORM ACTION=\"/login\" METHOD=\"POST\">\n");
43 wprintf("<TABLE border><TR>\n");
44 wprintf("<TD>User Name:</TD>\n");
45 wprintf("<TD><INPUT TYPE=\"text\" NAME=\"name\" MAXLENGTH=\"25\">\n");
46 wprintf("</TD></TR><TR>\n");
47 wprintf("<TD>Password:</TD>\n");
48 wprintf("<TD><INPUT TYPE=\"password\" NAME=\"pass\" MAXLENGTH=\"20\"></TD>\n");
49 wprintf("</TR></TABLE>\n");
50 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Login\">\n");
51 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"New User\">\n");
52 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Exit\">\n");
53 wprintf("</FORM></CENTER>\n");
54 wprintf("</BODY></HTML>\n");
62 * This function needs to get called whenever a PASS or NEWU succeeds
64 void become_logged_in(char *user, char *pass, char *serv_response) {
66 extract(wc_username, &serv_response[4], 0);
67 strcpy(wc_password, pass);
68 axlevel = extract_int(&serv_response[4], 1);
69 if (axlevel >=6) is_aide = 1;
75 char actual_username[256];
77 if (!strcasecmp(bstr("action"), "Login")) {
78 serv_printf("USER %s", bstr("name"));
81 serv_printf("PASS %s", bstr("pass"));
84 become_logged_in(bstr("name"),
91 output_static("frameset.html");
94 printf("HTTP/1.0 200 OK\n");
96 wprintf("<HTML><HEAD><TITLE>Nope</TITLE></HEAD><BODY>\n");
97 wprintf("Your password was not accepted.\n");
98 wprintf("<HR><A HREF=\"/\">Try again</A>\n");
99 wprintf("</BODY></HTML>\n");
106 printf("HTTP/1.0 200 OK\n");
108 wprintf("<HTML><BODY>\n");
109 wprintf("<CENTER><H1>");
110 escputs(wc_username);
112 /* other stuff here */
113 wprintf("</BODY></HTML>\n");
121 strcpy(wc_username, "");
122 strcpy(wc_password, "");
123 strcpy(wc_roomname, "");
127 printf("HTTP/1.0 200 OK\n");
129 printf("X-WebCit-Session: close\n");
131 wprintf("<HTML><HEAD><TITLE>Goodbye</TITLE></HEAD><BODY><CENTER>\n");
133 serv_puts("MESG goodbye");
136 if (buf[0]=='1') fmout(NULL);
137 else wprintf("Goodbye\n");
139 wprintf("</CENTER></BODY></HTML>\n");