4 * This file contains code which relates to authentication of users to Citadel.
23 * Display the login screen
25 void display_login(void) {
28 printf("HTTP/1.0 200 OK\n");
31 wprintf("<HTML><BODY>\n");
32 wprintf("<CENTER><TABLE border=0><TR><TD>\n");
34 /* FIX replace with the correct image */
35 wprintf("<IMG SRC=\"/static/velma.gif\">");
36 wprintf("</TD><TD><CENTER>\n");
38 serv_puts("MESG hello");
40 if (buf[0]=='1') fmout(NULL);
42 wprintf("</CENTER></TD></TR></TABLE></CENTER>\n");
45 /* FIX add instructions here */
46 wprintf("<CENTER><FORM ACTION=\"/login\" METHOD=\"POST\">\n");
47 wprintf("<TABLE border><TR>\n");
48 wprintf("<TD>User Name:</TD>\n");
49 wprintf("<TD><INPUT TYPE=\"text\" NAME=\"name\" MAXLENGTH=\"25\">\n");
50 wprintf("</TD></TR><TR>\n");
51 wprintf("<TD>Password:</TD>\n");
52 wprintf("<TD><INPUT TYPE=\"password\" NAME=\"pass\" MAXLENGTH=\"20\"></TD>\n");
53 wprintf("</TR></TABLE>\n");
54 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Login\">\n");
55 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"New User\">\n");
56 wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Exit\">\n");
57 wprintf("</FORM></CENTER>\n");
58 wprintf("</BODY></HTML>\n");
66 * This function needs to get called whenever a PASS or NEWU succeeds
68 void become_logged_in(char *user, char *pass, char *serv_response) {
70 extract(wc_username, &serv_response[4], 0);
71 strcpy(wc_password, pass);
72 axlevel = extract_int(&serv_response[4], 1);
73 if (axlevel >=6) is_aide = 1;
80 if (!strcasecmp(bstr("action"), "Login")) {
81 serv_printf("USER %s", bstr("name"));
84 serv_printf("PASS %s", bstr("pass"));
87 become_logged_in(bstr("name"),
94 output_static("frameset.html");
97 printf("HTTP/1.0 200 OK\n");
99 wprintf("<HTML><HEAD><TITLE>Nope</TITLE></HEAD><BODY>\n");
100 wprintf("Your password was not accepted.\n");
101 wprintf("<HR><A HREF=\"/\">Try again</A>\n");
102 wprintf("</BODY></HTML>\n");
108 void do_welcome(void) {
109 printf("HTTP/1.0 200 OK\n");
111 wprintf("<HTML><BODY>\n");
112 wprintf("<CENTER><H1>");
113 escputs(wc_username);
115 /* other stuff here */
116 wprintf("</BODY></HTML>\n");
121 void do_logout(void) {
124 strcpy(wc_username, "");
125 strcpy(wc_password, "");
126 strcpy(wc_roomname, "");
130 printf("HTTP/1.0 200 OK\n");
132 printf("X-WebCit-Session: close\n");
134 wprintf("<HTML><HEAD><TITLE>Goodbye</TITLE></HEAD><BODY><CENTER>\n");
136 serv_puts("MESG goodbye");
139 if (buf[0]=='1') fmout(NULL);
140 else wprintf("Goodbye\n");
142 wprintf("</CENTER></BODY></HTML>\n");