mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-27 07:34:44 +02:00
Stricter check on entered email addresses; the same check is now used for new
accounts as well as changes in existing accounts. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@268 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
9beae9e40d
commit
d71b47be7e
@ -8,6 +8,8 @@
|
|||||||
* Selecting a game to watch with an uppercase letter attempts to
|
* Selecting a game to watch with an uppercase letter attempts to
|
||||||
change the window size to the game's via the \033[8;<r>;<c>t
|
change the window size to the game's via the \033[8;<r>;<c>t
|
||||||
sequence.
|
sequence.
|
||||||
|
* Stricter check on entered email addresses; the same check is now
|
||||||
|
used for new accounts as well as changes in existing accounts.
|
||||||
|
|
||||||
1.4.3 (2004/02/28)
|
1.4.3 (2004/02/28)
|
||||||
* Make ttyplay use the 'strip' value it remembered from last view.
|
* Make ttyplay use the 'strip' value it remembered from last view.
|
||||||
|
@ -417,6 +417,47 @@ inprogressmenu ()
|
|||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check email address, returns 1 if valid, 0 otherwise.
|
||||||
|
* Doesn't recognize addresses with parts in double-quotes.
|
||||||
|
* Addresses with a colon in them are always rejected.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
check_email (char *s)
|
||||||
|
{
|
||||||
|
char *atomchars = "!#$%&'*+-/=?^_`{|}~" "0123456789"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
if (*s == '@')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (*s != '\0' && *s != '@')
|
||||||
|
{
|
||||||
|
if (strchr(atomchars, *s) == NULL)
|
||||||
|
return 0;
|
||||||
|
s++;
|
||||||
|
if (*s == '.')
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*s == '\0')
|
||||||
|
return 0;
|
||||||
|
s++;
|
||||||
|
|
||||||
|
f = 0;
|
||||||
|
while (*s != '\0')
|
||||||
|
{
|
||||||
|
if (strchr(atomchars, *s) == NULL)
|
||||||
|
return 0;
|
||||||
|
s++;
|
||||||
|
if (*s == '.')
|
||||||
|
s++, f = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
change_email ()
|
change_email ()
|
||||||
{
|
{
|
||||||
@ -442,8 +483,7 @@ change_email ()
|
|||||||
mvaddstr (8, 1, "That's the same one as before. Try again?");
|
mvaddstr (8, 1, "That's the same one as before. Try again?");
|
||||||
move(1,1);
|
move(1,1);
|
||||||
}
|
}
|
||||||
/* rudimentary check for validity */
|
else if (check_email (buf))
|
||||||
else if (strchr(buf, '@') < strrchr(buf, '.'))
|
|
||||||
{
|
{
|
||||||
mvprintw (8, 1, "Changing email address to '%s'. Confirm (y/n): ", buf);
|
mvprintw (8, 1, "Changing email address to '%s'. Confirm (y/n): ", buf);
|
||||||
if (getch() == 'y')
|
if (getch() == 'y')
|
||||||
@ -861,23 +901,35 @@ newuser ()
|
|||||||
|
|
||||||
/* email step */
|
/* email step */
|
||||||
|
|
||||||
|
error = 2;
|
||||||
|
while (error != 0)
|
||||||
|
{
|
||||||
clear ();
|
clear ();
|
||||||
|
|
||||||
drawbanner (1, 1);
|
drawbanner (1, 1);
|
||||||
|
|
||||||
mvaddstr (5, 1, "Please enter your email address.");
|
mvaddstr (5, 1, "Please enter your email address.");
|
||||||
mvaddstr (6, 1,
|
mvaddstr (6, 1, "This is sent _nowhere_ but will be used if you ask"
|
||||||
"This is sent _nowhere_ but will be used if you ask the sysadmin for lost");
|
" the sysadmin for lost");
|
||||||
mvaddstr (7, 1,
|
mvaddstr (7, 1, "password help. Please use a correct one. It only"
|
||||||
"password help. Please use a correct one. It only benefits you.");
|
" benefits you.");
|
||||||
mvaddstr (8, 1, "80 character max. No ':' characters. Blank line aborts.");
|
mvaddstr (8, 1, "80 character max. No ':' characters. Blank line"
|
||||||
|
" aborts.");
|
||||||
mvaddstr (10, 1, "=> ");
|
mvaddstr (10, 1, "=> ");
|
||||||
|
|
||||||
|
if (error == 1)
|
||||||
|
{
|
||||||
|
mvaddstr (12, 1, "There was a problem with your last entry.");
|
||||||
|
move (10, 4);
|
||||||
|
}
|
||||||
|
|
||||||
refresh ();
|
refresh ();
|
||||||
mygetnstr (buf, 80, 1);
|
mygetnstr (buf, 80, 1);
|
||||||
|
|
||||||
if (strchr (buf, ':') != NULL)
|
if (check_email (buf))
|
||||||
graceful_exit (113);
|
error = 0;
|
||||||
|
else
|
||||||
|
error = 1;
|
||||||
|
|
||||||
if (buf && *buf == '\0')
|
if (buf && *buf == '\0')
|
||||||
{
|
{
|
||||||
@ -887,6 +939,7 @@ newuser ()
|
|||||||
me = NULL;
|
me = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
me->email = strdup (buf);
|
me->email = strdup (buf);
|
||||||
me->env = calloc (1, 1);
|
me->env = calloc (1, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user