summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-10 13:41:02 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-10 13:41:02 +0800
commit23203492b9e7df03c4b07e7eae5afa145da138ed (patch)
treea271ca35995d21cf6f010a38606b79cc1b2a7284
parent581d8f19dc4a8dd4321cfa2cf940c3ecaf52f3c8 (diff)
downloadpttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar.gz
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar.bz2
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar.lz
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar.xz
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.tar.zst
pttbbs-23203492b9e7df03c4b07e7eae5afa145da138ed.zip
- register: check copy-pasting sample birthday
- register: reduce captcha max tries git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4287 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/register.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 6117b47e..3568d61f 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -20,6 +20,7 @@
// #define DBG_DRYRUN // Dry-run test (mainly for RegForm2)
#define MSG_ERR_MAXTRIES "您嘗試錯誤的輸入次數太多,請下次再來吧"
+#define DATE_SAMPLE "1911/2/29"
////////////////////////////////////////////////////////////////////////////
// Password Hash
@@ -491,14 +492,14 @@ int verify_captcha()
// input captcha
move(b_lines-1, 0); clrtobot();
- prints("請輸入圖樣顯示的 %d 個英文字母: ", strlen(captcha));
+ prints("請輸入圖樣顯示的 %d 個英文字母: ", (int)strlen(captcha));
vgetstring(code, strlen(captcha)+1, 0, "", &vge, NULL);
if (code[0] && strcasecmp(code, captcha) == 0)
break;
// error case.
- if (++tries >= 20)
+ if (++tries >= 10)
return 0;
// error
@@ -808,9 +809,14 @@ new_register(void)
vmsg(MSG_ERR_MAXTRIES);
exit(1);
}
- getdata(22, 0, "生日 (西元年/月/日, 如 1901/02/29):", birthday,
+ getdata(22, 0, "生日 (西元年/月/日, 如 " DATE_SAMPLE "):", birthday,
sizeof(birthday), DOECHO);
+ if (strcmp(birthday, DATE_SAMPLE) == 0) {
+ vmsg("不要複製範例! 請輸入你真實生日");
+ continue;
+ }
+
if (ParseDate(birthday, &y, &m, &d)) {
vmsg("日期格式不正確");
continue;
@@ -858,9 +864,14 @@ check_birthday(void)
move(2,0);
outs("本站為配合實行內容分級制度,請您輸入正確的生日資訊。");
- getdata(5, 0, "生日 (西元年/月/日, 如 1984/02/29):", birthday,
+ getdata(5, 0, "生日 (西元年/月/日, 如 " DATE_SAMPLE "):", birthday,
sizeof(birthday), DOECHO);
+ if (strcmp(birthday, DATE_SAMPLE) == 0) {
+ vmsg("不要複製範例! 請輸入你真實生日");
+ continue;
+ }
+
if (ParseDate(birthday, &y, &m, &d)) {
vmsg("日期格式不正確");
continue;
@@ -1355,7 +1366,8 @@ u_register(void)
getfield(12, "只輸入數字 如:0912345678 (可不填)",
"手機號碼", mobile, 20);
while (1) {
- getfield(13, "西元/月月/日日 如:1984/02/29", "生日", birthday, sizeof(birthday));
+ getfield(13, "西元/月月/日日 如: " DATE_SAMPLE ,
+ "生日", birthday, sizeof(birthday));
if (birthday[0] == 0) {
snprintf(birthday, sizeof(birthday), "%04i/%02i/%02i",
1900 + cuser.year, cuser.month, cuser.day);
@@ -1364,6 +1376,10 @@ u_register(void)
year = cuser.year;
} else {
int y, m, d;
+ if (strcmp(birthday, DATE_SAMPLE) == 0) {
+ vmsg("不要複製範例! 請輸入你真實生日");
+ continue;
+ }
if (ParseDate(birthday, &y, &m, &d)) {
vmsg("您的輸入不正確");
continue;