]> skyeroc.xyz Git - dgamelaunch/commitdiff
User is now prompted for their password twice at registration.
authorBrett Carrington <brettcar@segvio.org>
Wed, 31 Dec 2003 18:14:07 +0000 (18:14 +0000)
committerBrett Carrington <brettcar@segvio.org>
Wed, 31 Dec 2003 18:14:07 +0000 (18:14 +0000)
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
dgamelaunch.c

index d34083c99f9b45b13096a7f63c02e6ec416147a5..0a7debe9fd8d0f9b9c1bb248ed84fe576a964005 100644 (file)
@@ -1 +1,2 @@
 dgamelaunch
+tags
index 0902018aa4bfab45e23a957c1b5d84f05c1e93e4..ee262296310c9736b4ca6de873444f3be67a0b9f 100644 (file)
@@ -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 ();