X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fauth.c;h=a2f51d6d792a8d99f9bb41c4acf64097c1755ac9;hb=792253218528e4327e0ddf1da78e424c9c9f08a4;hp=814a43b6896205639627fb835d0c1c9001828e8a;hpb=430e6f04465553b99a605ff923ce6103086084e9;p=citadel.git diff --git a/webcit/auth.c b/webcit/auth.c index 814a43b68..a2f51d6d7 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -46,19 +46,21 @@ void display_login(char *mesg) { char buf[SIZ]; - output_headers(3); + output_headers(1, 1, 2, 0, 0, 0, 0); + wprintf("
\n"); if (mesg != NULL) if (strlen(mesg) > 0) { - stresc(buf, mesg, 0); + stresc(buf, mesg, 0, 0); svprintf("mesg", WCS_STRING, "%s", buf); } svprintf("hello", WCS_SERVCMD, "MESG hello"); + svprintf("BOXTITLE", WCS_STRING, "%s - powered by Citadel", + serv_info.serv_humannode); do_template("login"); - clear_local_substs(); - wDumpContent(0); /* No menu here; not logged in yet! */ + wDumpContent(2); } @@ -158,8 +160,8 @@ void do_welcome(void) svprintf("STARTPAGE", WCS_STRING, startpage); - do_template("mainframeset"); - clear_local_substs(); + /* FIXME ... go to my start page, not to the summary */ + summary(); } @@ -181,7 +183,8 @@ void do_logout(void) strcpy(WC->wc_password, ""); strcpy(WC->wc_roomname, ""); - output_headers(2); /* note "2" causes cookies to be unset */ + /* Calling output_headers() this way causes the cookies to be un-set */ + output_headers(1, 1, 0, 1, 0, 0, 0); wprintf("
"); serv_puts("MESG goodbye"); @@ -189,7 +192,7 @@ void do_logout(void) if (WC->serv_sock >= 0) { if (buf[0] == '1') { - fmout(NULL); + fmout(NULL, "CENTER"); } else { wprintf("Goodbye\n"); } @@ -201,7 +204,7 @@ void do_logout(void) ); } - wprintf("
Log in again   " + wprintf("
Log in again   " "Close window" "
\n"); wDumpContent(2); @@ -209,7 +212,6 @@ void do_logout(void) } - /* * validate new users */ @@ -220,25 +222,30 @@ void validate(void) char buf[SIZ]; int a; - output_headers(3); + output_headers(1, 1, 0, 0, 0, 0, 0); strcpy(buf, bstr("user")); if (strlen(buf) > 0) - if (strlen(bstr("WC->axlevel")) > 0) { - serv_printf("VALI %s|%s", buf, bstr("WC->axlevel")); + if (strlen(bstr("axlevel")) > 0) { + serv_printf("VALI %s|%s", buf, bstr("axlevel")); serv_gets(buf); if (buf[0] != '2') { - wprintf("%s
\n", &buf[4]); + wprintf("%s
\n", &buf[4]); } } serv_puts("GNUR"); serv_gets(buf); if (buf[0] != '3') { - wprintf("%s
\n", &buf[4]); + wprintf("%s
\n", &buf[4]); wDumpContent(1); return; } + + wprintf("
"); + do_template("beginbox_nt"); + wprintf("
"); + strcpy(user, &buf[4]); serv_printf("GREG %s", user); serv_gets(cmd); @@ -248,47 +255,47 @@ void validate(void) serv_gets(buf); ++a; if (a == 1) - wprintf("User #%s

%s

", + wprintf("User #%s

%s

", buf, &cmd[4]); if (a == 2) - wprintf("PW: %s
\n", buf); + wprintf("PW: %s
\n", buf); if (a == 3) - wprintf("%s
\n", buf); + wprintf("%s
\n", buf); if (a == 4) - wprintf("%s
\n", buf); + wprintf("%s
\n", buf); if (a == 5) wprintf("%s, ", buf); if (a == 6) wprintf("%s ", buf); if (a == 7) - wprintf("%s
\n", buf); + wprintf("%s
\n", buf); if (a == 8) - wprintf("%s
\n", buf); + wprintf("%s
\n", buf); if (a == 9) wprintf("Current access level: %d (%s)\n", atoi(buf), axdefs[atoi(buf)]); } while (strcmp(buf, "000")); } else { - wprintf("

%s

%s
\n", user, &cmd[4]); + wprintf("

%s

%s
\n", user, &cmd[4]); } - wprintf("
"); + wprintf("
Select access level for this user:
\n"); for (a = 0; a <= 6; ++a) { - wprintf("\n", + wprintf("&axlevel=%d\">%s   \n", a, axdefs[a]); } - wprintf("
Select access level:"); - wprintf("
axlevel=%d\">%s

\n"); + wprintf("
\n"); + + wprintf("
\n"); + do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } - - - /* * Display form for registration. * (Set during_login to 1 if this registration is being performed during @@ -296,105 +303,29 @@ void validate(void) */ void display_reg(int during_login) { - char buf[SIZ]; - int a; - - output_headers(3); - - wprintf("
"); - wprintf("Enter registration info\n"); - wprintf("
\n"); - - wprintf("
"); - serv_puts("MESG register"); - serv_gets(buf); - if (buf[0] == '1') - fmout(NULL); - - wprintf("
\n"); - wprintf("\n", during_login); - - serv_puts("GREG _SELF_"); - serv_gets(buf); - if (buf[0] != '1') { - wprintf("%s
\n", &buf[4]); - } else { + long vcard_msgnum; - wprintf("

%s

\n", &buf[4]); - a = 0; - while (serv_gets(buf), strcmp(buf, "000")) { - ++a; - wprintf("\n"); - } - wprintf("
"); - switch (a) { - case 3: - wprintf("Real Name:
\n", buf); - break; - case 4: - wprintf("Street Address:

\n", buf); - break; - case 5: - wprintf("City/town:

\n", buf); - break; - case 6: - wprintf("State/province:

\n", buf); - break; - case 7: - wprintf("ZIP/postal code:

\n", buf); - break; - case 8: - wprintf("Telephone:

\n", buf); - break; - case 10: - wprintf("E-Mail:

\n", buf); - break; - case 11: - wprintf("Country:

\n", buf); - break; - } - wprintf("

"); + if (goto_config_room() != 0) { + if (during_login) do_welcome(); + else display_main_menu(); + return; } - wprintf("\n"); - wprintf("\n"); - wprintf("

\n"); - wDumpContent(1); -} - -/* - * register - */ -void register_user(void) -{ - char buf[SIZ]; - if (strcmp(bstr("action"), "Register")) { - display_error("Cancelled. Registration was not saved."); + vcard_msgnum = locate_user_vcard(WC->wc_username, -1); + if (vcard_msgnum < 0L) { + if (during_login) do_welcome(); + else display_main_menu(); return; } - serv_puts("REGI"); - serv_gets(buf); - if (buf[0] != '4') { - display_error(&buf[4]); + + if (during_login) { + do_edit_vcard(vcard_msgnum, "1", "/do_welcome"); } - serv_puts(bstr("realname")); - serv_puts(bstr("address")); - serv_puts(bstr("city")); - serv_puts(bstr("state")); - serv_puts(bstr("zip")); - serv_puts(bstr("phone")); - serv_puts(bstr("email")); - serv_puts(bstr("country")); - serv_puts("000"); - - if (atoi(bstr("during_login"))) { - do_welcome(); - } else { - display_success("Registration information has been saved."); + else { + do_edit_vcard(vcard_msgnum, "1", "/display_main_menu"); } -} +} @@ -406,28 +337,31 @@ void display_changepw(void) { char buf[SIZ]; - output_headers(3); - - wprintf("
"); - wprintf("Change your password\n"); - wprintf("
\n"); + output_headers(1, 1, 0, 0, 0, 0, 0); - wprintf("
"); + svprintf("BOXTITLE", WCS_STRING, "Change your password"); + do_template("beginbox"); + wprintf("

"); serv_puts("MESG changepw"); serv_gets(buf); - if (buf[0] == '1') - fmout(NULL); + if (buf[0] == '1') { + fmout(NULL, "CENTER"); + } wprintf("\n"); - wprintf("
\n"); + wprintf("
" + "
Enter new password:
" + "\n"); wprintf("\n"); wprintf("\n"); wprintf("\n"); - wprintf("
Enter new password:
Enter it again to confirm:
\n"); - wprintf("\n"); - wprintf("\n"); + wprintf("
\n"); + wprintf("\n" + " " + "\n"); wprintf("
\n"); + do_template("endbox"); wDumpContent(1); } @@ -440,20 +374,22 @@ void changepw(void) char newpass1[32], newpass2[32]; if (strcmp(bstr("action"), "Change")) { - display_error("Cancelled. Password was not changed."); + strcpy(WC->ImportantMessage, + "Cancelled. Password was not changed."); + display_main_menu(); return; } strcpy(newpass1, bstr("newpass1")); strcpy(newpass2, bstr("newpass2")); if (strcasecmp(newpass1, newpass2)) { - display_error("They don't match. Password was not changed."); + strcpy(WC->ImportantMessage, + "They don't match. Password was not changed."); + display_main_menu(); return; } serv_printf("SETP %s", newpass1); serv_gets(buf); - if (buf[0] == '2') - display_success(&buf[4]); - else - display_error(&buf[4]); + strcpy(WC->ImportantMessage, &buf[4]); + display_main_menu(); }