From ee0ef37a0ee991955fcc4eacedec93895bdcf31f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 4 Jan 1999 01:18:44 +0000 Subject: [PATCH] Added "change password" --- webcit/ChangeLog | 1 + webcit/auth.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ webcit/child.h | 5 +++- webcit/graphics.c | 3 +-- webcit/webcit.c | 26 +++++++++++++++----- 5 files changed, 87 insertions(+), 9 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 144347380..c7b2af093 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -4,6 +4,7 @@ Sun Jan 3 20:05:31 EST 1999 Art Cancro says it's needed * Established that a one-to-one WebCit/Citadel correspondence will be required. No big deal due to shared code segments. + * Added "change password" Thu Dec 31 21:53:20 EST 1998 Art Cancro * Final cvs commit for 1998 (an awful year, I'm glad to see it over). diff --git a/webcit/auth.c b/webcit/auth.c index b865ab7cf..4172c76f7 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -379,3 +379,64 @@ void register_user(void) { display_error("Registration information has been saved."); } } + + + + + +/* + * display form for changing your password + */ +void display_changepw(void) { + char buf[256]; + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + + wprintf("
"); + wprintf("Change your password\n"); + wprintf("
\n"); + + wprintf("
"); + serv_puts("MESG changepw"); + serv_gets(buf); + if (buf[0]=='1') fmout(NULL); + + wprintf("
\n"); + wprintf("
\n"); + wprintf("\n"); + wprintf("\n"); + wprintf("\n"); + wprintf("
Enter new password:
Enter it again to confirm:
\n"); + wprintf("\n"); + wprintf("\n"); + wprintf("
\n"); + wDumpContent(); + } + +/* + * change password + */ +void changepw(void) { + char buf[256]; + char newpass1[32], newpass2[32]; + + if (strcmp(bstr("action"),"Change")) { + display_error("Cancelled. Password was not changed."); + return; + } + + strcpy(newpass1, bstr("newpass1")); + strcpy(newpass2, bstr("newpass2")); + + if (strcasecmp(newpass1, newpass2)) { + display_error("They don't match. Password was not changed."); + return; + } + + serv_printf("SETP %s", newpass1); + serv_gets(buf); + if (buf[0]=='2') display_success(&buf[4]); + else display_error(&buf[4]); + } diff --git a/webcit/child.h b/webcit/child.h index 99ec7cc19..aa5810346 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -57,7 +57,8 @@ void goto_private(void); void zapped_list(void); void display_zap(void); void zap(void); -void display_error(char *errormessage); +void display_error(char *); +void display_success(char *); void display_entroom(void); void entroom(void); void display_editroom(void); @@ -83,3 +84,5 @@ void load_floorlist(void); void select_floor_to_edit_pic(void); void display_reg(int); void register_user(void); +void display_changepw(void); +void changepw(void); diff --git a/webcit/graphics.c b/webcit/graphics.c index e08d7150f..c2e6cb8ee 100644 --- a/webcit/graphics.c +++ b/webcit/graphics.c @@ -77,9 +77,8 @@ void do_graphics_upload(char *upl_cmd) { serv_puts("UCLS 1"); serv_gets(buf); - /* FIX display something other than an error if it's ok */ if (buf[0] != 'x') { - display_error(&buf[4]); + display_success(&buf[4]); return; } } diff --git a/webcit/webcit.c b/webcit/webcit.c index 749dcb7a6..551b13c36 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -426,20 +426,27 @@ void output_image() { /* - * Convenience function to display a page containing only an error string + * Convenience functions to display a page containing only a string */ -void display_error(char *errormessage) { +void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext) { printf("HTTP/1.0 200 OK\n"); output_headers(1); - wprintf("
"); + wprintf("
", titlebarcolor); wprintf("Error\n"); + wprintf("%s\n", titlebarmsg); wprintf("

\n"); - escputs(errormessage); + escputs(messagetext); wprintf("\n"); wDumpContent(); } +void display_error(char *errormessage) { + convenience_page("770000", "Error", errormessage); + } + +void display_success(char *successmessage) { + convenience_page("007700", "OK", successmessage); + } @@ -584,7 +591,6 @@ void session_loop(void) { } } - /* FIX unfix etc. here's where the addurls() WAS... */ if (!strcasecmp(action, "static")) { strcpy(buf, &cmd[12]); for (a=0; a