summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-31 01:00:25 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-31 01:00:25 +0800
commitb980cfa8c8f27bf5b014bdc948b225fa24c509e3 (patch)
treedfb1400d432a2db1efa93fa2fc08cf57bf3539ae /mbbsd
parent94532885c8a36425666519d233c310146a291ce4 (diff)
downloadpttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar.gz
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar.bz2
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar.lz
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar.xz
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.tar.zst
pttbbs-b980cfa8c8f27bf5b014bdc948b225fa24c509e3.zip
- register: make birthday registration earlier, also helps over18 work correctly.
- register: change '1st register' check to email instead of birthday:year. - emaildb: fix offset-by-one (because the 'self' is not counted now) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3890 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/emaildb.c3
-rw-r--r--mbbsd/name.c2
-rw-r--r--mbbsd/register.c28
-rw-r--r--mbbsd/user.c7
4 files changed, 36 insertions, 4 deletions
diff --git a/mbbsd/emaildb.c b/mbbsd/emaildb.c
index d8f0ae05..90cd567e 100644
--- a/mbbsd/emaildb.c
+++ b/mbbsd/emaildb.c
@@ -47,6 +47,9 @@ int emaildb_check_email(char * email, int email_len)
// use mail.
if (strcasecmp(result, cuser.userid) == 0)
continue;
+
+ // force update
+ u.email[0] = 0;
if (getuser(result, &u))
if (strcasecmp(email, u.email) == 0)
diff --git a/mbbsd/name.c b/mbbsd/name.c
index 0f2b1ef4..1ccab86a 100644
--- a/mbbsd/name.c
+++ b/mbbsd/name.c
@@ -1025,7 +1025,7 @@ completeboard_permission(int where)
return (!(bptr->brdattr & BRD_SYMBOLIC) &&
(GROUPOP() || HasBoardPerm(bptr)) &&
!(bptr->brdattr & BRD_GROUPBOARD) &&
- !(bptr->brdattr & BRD_OVER18 && !over18));
+ !((bptr->brdattr & BRD_OVER18) && !over18));
}
int
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 0a41a2e5..1df379bf 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1,6 +1,9 @@
/* $Id$ */
#include "bbs.h"
+// prototype of crypt()
+char *crypt(const char *key, const char *salt);
+
char *
genpasswd(char *pw)
{
@@ -337,6 +340,31 @@ new_register(void)
sizeof(newuser.address), DOECHO);
}
+ try = 0;
+ while (newuser.year < 40) // magic number 40: see user.c
+ {
+ char birthday[sizeof("mmmm/yy/dd ")];
+ int y, m, d;
+
+ if (++try > 20) {
+ vmsg("您嘗試錯誤的輸入太多,請下次再來吧");
+ exit(1);
+ }
+ getdata(22, 0, "生日 (西元年/月/日, 如 1984/02/29):", birthday,
+ sizeof(birthday), DOECHO);
+
+ if (ParseDate(birthday, &y, &m, &d)) {
+ vmsg("日期格式不正確");
+ continue;
+ } else if (y < 1940) {
+ vmsg("你真的有那麼老嗎?");
+ continue;
+ }
+ newuser.year = (unsigned char)(y-1900);
+ newuser.month = (unsigned char)m;
+ newuser.day = (unsigned char)d;
+ }
+
setupnewuser(&newuser);
if( (uid = initcuser(newuser.userid)) < 0) {
diff --git a/mbbsd/user.c b/mbbsd/user.c
index d8bc901d..83402dfe 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1465,7 +1465,7 @@ toregister(char *email, char *phone, char *career,
outs("暫時不允許\ email 認證註冊, 請稍後再試\n");
pressanykey();
return;
- } else if (email_count > EMAILDB_LIMIT) {
+ } else if (email_count >= EMAILDB_LIMIT) {
move(15, 0); clrtobot();
move(17, 0);
outs("指定的 E-Mail 已註冊過多帳號, 請使用其他 E-Mail, 或輸入 x 採手動認證\n");
@@ -1736,8 +1736,9 @@ u_register(void)
goto REGFORM;
}
- // XXX why check by year?
- if (cuser.year != 0 && /* 已經第一次填過了~ ^^" */
+ // XXX why check by year?
+ // birthday is moved to earlier, so let's check email instead.
+ if (cuser.email[0] && // cuser.year != 0 && /* 已經第一次填過了~ ^^" */
strcmp(cuser.email, "x") != 0 && /* 上次手動認證失敗 */
strcmp(cuser.email, "X") != 0) {
clear();