4 * This file contains code which relates to authentication of users to Citadel.
21 * Display the login screen
23 void display_login(void) {
26 printf("HTTP/1.0 200 OK\n");
29 wprintf("<HTML><BODY>\n");
30 wprintf("<CENTER><TABLE border=0><TR><TD>\n");
32 /* FIX replace with the correct image */
33 wprintf("<IMG SRC=\"/static/velma.gif\">");
34 wprintf("</TD><TD><CENTER>\n");
36 serv_puts("MESG hello");
38 if (buf[0]=='1') fmout(NULL);
40 wprintf("</CENTER></TD></TR></TABLE></CENTER>\n");
43 /* FIX add instructions here */
44 wprintf("<CENTER><FORM ACTION=\"/login\" METHOD=\"POST\">\n");
45 wprintf("<TABLE border><TR>\n");
46 wprintf("<TD>User Name:</TD>\n");
47 wprintf("<TD><INPUT TYPE=\"text\" NAME=\"name\" MAXLENGTH=\"25\">\n");
48 wprintf("</TD></TR><TR>\n");
49 wprintf("<TD>Password:</TD>\n");
50 wprintf("<TD><INPUT TYPE=\"password\" NAME=\"pass\" MAXLENGTH=\"20\"></TD>\n");
51 wprintf("</TR></TABLE>\n");
52 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Login\">\n");
53 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"New User\">\n");
54 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Exit\">\n");
55 wprintf("</FORM></CENTER>\n");
56 wprintf("</BODY></HTML>\n");
64 * This function needs to get called whenever a PASS or NEWU succeeds
66 void become_logged_in(char *user, char *pass, char *serv_response) {
68 extract(wc_username, &serv_response[4], 0);
69 strcpy(wc_password, pass);
70 axlevel = extract_int(&serv_response[4], 1);
71 if (axlevel >=6) is_aide = 1;
78 if (!strcasecmp(bstr("action"), "Login")) {
79 serv_printf("USER %s", bstr("name"));
82 serv_printf("PASS %s", bstr("pass"));
85 become_logged_in(bstr("name"),
92 output_static("frameset.html");
95 printf("HTTP/1.0 200 OK\n");
97 wprintf("<HTML><HEAD><TITLE>Nope</TITLE></HEAD><BODY>\n");
98 wprintf("Your password was not accepted.\n");
99 wprintf("<HR><A HREF=\"/\">Try again</A>\n");
100 wprintf("</BODY></HTML>\n");
106 void do_welcome(void) {
107 printf("HTTP/1.0 200 OK\n");
109 wprintf("<HTML><BODY>\n");
110 wprintf("<CENTER><H1>");
111 escputs(wc_username);
113 /* other stuff here */
114 wprintf("</BODY></HTML>\n");
119 void do_logout(void) {
122 strcpy(wc_username, "");
123 strcpy(wc_password, "");
124 strcpy(wc_roomname, "");
128 printf("HTTP/1.0 200 OK\n");
130 printf("X-WebCit-Session: close\n");
132 wprintf("<HTML><HEAD><TITLE>Goodbye</TITLE></HEAD><BODY><CENTER>\n");
134 serv_puts("MESG goodbye");
137 if (buf[0]=='1') fmout(NULL);
138 else wprintf("Goodbye\n");
140 wprintf("</CENTER></BODY></HTML>\n");