summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-02 23:16:23 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-02 23:16:23 +0800
commit4ef59339ce51c6378e04a7b716241bdbdd2b4e6a (patch)
treef53f4d01df9150516a849fb2a906156db93f042d /mbbsd
parent157b1d72211ffacf8614d6a5e96e8cf536f93e78 (diff)
downloadpttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar.gz
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar.bz2
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar.lz
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar.xz
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.tar.zst
pttbbs-4ef59339ce51c6378e04a7b716241bdbdd2b4e6a.zip
use emaildb interface in user register
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3774 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/Makefile7
-rw-r--r--mbbsd/user.c31
2 files changed, 34 insertions, 4 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile
index 1917f87b..9eb6bbc2 100644
--- a/mbbsd/Makefile
+++ b/mbbsd/Makefile
@@ -10,9 +10,10 @@ CFLAGS+= -DBLOG
LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient
.endif
-.if !defined(WITHOUT_EMAIL_DB) && defined(WITH_EMAIL_DB)
-CFLAGS+= -DUSE_EMAIL_DB
-LDFLAGS+= -L/usr/local/lib/sqlite3 -lsqlite3
+.if !defined(WITHOUT_EMAILDB) && defined(WITH_EMAILDB)
+OBJS+= emaildb.o
+CFLAGS+= -DUSE_EMAILDB
+LDFLAGS+= -lsqlite3
.endif
.if !defined(WITHOUT_PFTERM) && defined(WITH_PFTERM)
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 8645ab62..ce2dedbe 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -698,6 +698,7 @@ uinfo_query(userec_t *u, int adminmode, int unum)
if (strcmp(buf, x.email) && strchr(buf, '@')) {
strlcpy(x.email, buf, sizeof(x.email));
mail_changed = 1 - adminmode;
+ delregcodefile();
}
break;
case '7':
@@ -1077,7 +1078,6 @@ uinfo_query(userec_t *u, int adminmode, int unum)
snprintf(buf, sizeof(buf), "%d", x.mobile);
justify_wait(x.userid, phone, career, x.realname, x.address, buf);
- email_justify(&x);
}
memcpy(u, &x, sizeof(x));
if (i == QUIT) {
@@ -1441,10 +1441,29 @@ toregister(char *email, char *genbuf, char *phone, char *career,
#endif
else if (isvalidemail(email)) {
char yn[3];
+#ifdef USE_EMAILDB
+ int email_count = emaildb_check_email(email, strlen(email));
+
+ if (email_count < 0) {
+ move(15, 0); clrtobot();
+ move(17, 0);
+ outs("暫時不允許 email 認證註冊, 請稍後再試\n");
+ pressanykey();
+ return;
+ } else if (email_count >= EMAILDB_LIMIT) {
+ move(15, 0); clrtobot();
+ move(17, 0);
+ outs("指定的 E-Mail 已註冊過多帳號, 請使用其他 E-Mail, 或輸入 x 採手動認證\n");
+ outs("但注意手動認證通常會花上數週以上的時間。\n");
+ } else {
+#endif
getdata(16, 0, "請再次確認您輸入的 E-Mail 位置正確嘛? [y/N]",
yn, sizeof(yn), LCECHO);
if (yn[0] == 'Y' || yn[0] == 'y')
break;
+#ifdef USE_EMAILDB
+ }
+#endif
} else {
move(15, 0); clrtobot();
move(17, 0);
@@ -1452,6 +1471,16 @@ toregister(char *email, char *genbuf, char *phone, char *career,
outs("但注意手動認證通常會花上數週以上的時間。\n");
}
}
+#ifdef USE_EMAILDB
+ if (emaildb_update_email(cuser.userid, strlen(cuser.userid),
+ email, strlen(email)) < 0) {
+ move(15, 0); clrtobot();
+ move(17, 0);
+ outs("暫時不允許 email 認證註冊, 請稍後再試\n");
+ pressanykey();
+ return;
+ }
+#endif
strlcpy(cuser.email, email, sizeof(cuser.email));
REGFORM2:
if (strcasecmp(email, "x") == 0) { /* 手動認證 */