diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-07-19 21:46:20 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-07-19 21:46:20 +0800 |
commit | e04e87efd415a7b406e16269985b98f739924177 (patch) | |
tree | 0bcd5765ac6e1767baea183ca20dc6923b7561cf /mbbsd/user.c | |
parent | 8c221ff952ac371ff5828c03a70d7f0cfad5c712 (diff) | |
download | pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar.gz pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar.bz2 pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar.lz pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar.xz pttbbs-e04e87efd415a7b406e16269985b98f739924177.tar.zst pttbbs-e04e87efd415a7b406e16269985b98f739924177.zip |
regcodefile
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3380 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r-- | mbbsd/user.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c index 7934c4da..626761d5 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -485,6 +485,14 @@ void Customize(void) } static char * +getregfile(char *buf) +{ + // not in user's home because s/he could zip his/her home + snprintf(buf, PATHLEN, "jobspool/.regcode.%s", cuser.userid); + return buf; +} + +static char * makeregcode(char *buf) { char fpath[PATHLEN]; @@ -498,8 +506,7 @@ makeregcode(char *buf) for( i = 2 ; i < 13 ; ++i ) buf[i] = alphabet[rand() % 52]; - /* write to file */ - snprintf(fpath, PATHLEN, "jobspool/.regcode.%s", cuser.userid); + getregfile(fpath); if( (fd = open(fpath, O_WRONLY | O_CREAT, 0600)) == -1 ){ perror("open"); exit(1); @@ -515,7 +522,8 @@ getregcode(char *buf) { int fd; char fpath[PATHLEN]; - snprintf(fpath, PATHLEN, "jobspool/.regcode.%s", cuser.userid); + + getregfile(fpath); if( (fd = open(fpath, O_RDONLY)) == -1 ){ buf[0] = 0; return buf; @@ -526,6 +534,14 @@ getregcode(char *buf) return buf; } +static char * +delregcodefile(void) +{ + char fpath[PATHLEN]; + getregfile(fpath); + unlink(fpath); +} + #ifdef DEBUG int _debug_testregcode() @@ -1663,9 +1679,9 @@ u_register(void) inregcode[0] = 0; do{ - getdata(10, 0, "您的輸入: ", inregcode, sizeof(inregcode), DOECHO); - if( strcmp(inregcode, "x") == 0 || - strcmp(inregcode, "X") == 0 ) + getdata(10, 0, "您的認證碼:", + inregcode, sizeof(inregcode), DOECHO); + if( strcmp(inregcode, "x") == 0 || strcmp(inregcode, "X") == 0 ) break; if( inregcode[0] != 'v' || inregcode[1] != '6' ) { /* old regcode */ @@ -1679,6 +1695,7 @@ u_register(void) if (strcmp(inregcode, getregcode(regcode)) == 0) { int unum; + delregcodefile(); if ((unum = searchuser(cuser.userid, NULL)) == 0) { vmsg("系統錯誤,查無此人!"); u_exit("getuser error"); @@ -1695,7 +1712,7 @@ u_register(void) sethomefile(genbuf, cuser.userid, "justify.wait"); unlink(genbuf); snprintf(cuser.justify, sizeof(cuser.justify), - "%s:%s:auto", phone, career); + "%s:%s:email", phone, career); sethomefile(genbuf, cuser.userid, "justify"); log_file(genbuf, LOG_CREAT, cuser.justify); pressanykey(); |