From 82acdecfa1d143268989776587c4bf513e9c24c8 Mon Sep 17 00:00:00 2001 From: Brett Carrington Date: Wed, 31 Dec 2003 18:14:07 +0000 Subject: [PATCH] User is now prompted for their password twice at registration. Turned echo off during such prompting... And 'tags' file is in .cvsignore (so I can run ctags *.[ch]) git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@21 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- .cvsignore | 1 + dgamelaunch.c | 39 ++++++++++++++------------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.cvsignore b/.cvsignore index d34083c..0a7debe 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,2 @@ dgamelaunch +tags diff --git a/dgamelaunch.c b/dgamelaunch.c index 0902018..ee26229 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -284,9 +284,10 @@ changepw () char buf[21]; int error = 2; - if (!loggedin) - return; - + /* A precondiction is that struct `me' exists because we can be not-yet-logged-in. */ + if (!me) + exit(122); /* Die. */ + while (error) { char repeatbuf[21]; @@ -294,8 +295,7 @@ changepw () mvaddstr (1, 1, VER1); - mvaddstr (5, 1, - "Please enter a new password. Remember that this is sent over the net"); + mvprintw (5, 1, "Please enter a%s password. Remember that this is sent over the net", loggedin ? " new" : ""); mvaddstr (6, 1, "in plaintext, so make it something new and expect it to be relatively"); mvaddstr (7, 1, "insecure."); @@ -310,8 +310,11 @@ changepw () } refresh (); + + noecho(); getnstr (buf, 20); - + echo(); /* Putting echo back on just for saftey and because it can't hurt. */ + if (buf && *buf == '\0') return; @@ -320,8 +323,10 @@ changepw () mvaddstr (12, 1, "And again:"); mvaddstr (13, 1, "=> "); - + + noecho(); getnstr (repeatbuf, 20); + echo(); /* Here is the important echo(); if the former is removed. */ if (!strcmp (buf, repeatbuf)) error = 0; @@ -626,24 +631,8 @@ newuser () clear (); - mvaddstr (1, 1, VER1); - - mvaddstr (5, 1, "Please enter a password."); - mvaddstr (6, 1, - "This is only trivially encoded at the server. Please use something"); - mvaddstr (7, 1, "new and expect it to be relatively insecure."); - mvaddstr (8, 1, "20 character max. No ':' characters."); - mvaddstr (10, 1, "=> "); - - refresh (); - getnstr (buf, 20); - - /* we warned em */ - if (strstr (buf, ":") != NULL) - exit (112); - - me->password = strdup (crypt (buf, buf)); - + changepw(); /* Calling changepw instead to prompt twice. */ + /* email step */ clear ();