Commit fb43daf5 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Implement duplicate new-user email address checking (optional)

If a sysop wants to prevent new users from using an email address of an existing user, they can set SCFG->System->New User Values->Question Toggles->Force Unique E-mail/NetMail to "Yes".

This partially addresses issue #127, at least for the terminal server.
parent bdb08f66
Pipeline #2991 passed with stage
in 13 minutes and 34 seconds
......@@ -231,6 +231,7 @@ var UQ_NOCOMMAS =(1<<17); /* Do not require commas in location */
var UQ_NONETMAIL =(1<<18); /* Don't ask for e-mail/netmail address */
var UQ_NOUPRLWR =(1<<19); /* Don't force upper/lower case strings */
var UQ_COLORTERM =(1<<20); /* Ask if new user has color terminal */
var UQ_DUPNETMAIL =(1<<21); /* Don't allow duplicate netmail address */
/********************************************/
/********************************************/
......
......@@ -322,8 +322,11 @@ BOOL sbbs_t::newuser()
if(!online) return(FALSE);
while(!(cfg.uq&UQ_NONETMAIL) && online && text[EnterNetMailAddress][0]) {
bputs(text[EnterNetMailAddress]);
if(getstr(useron.netmail,LEN_NETMAIL,K_EDIT|K_AUTODEL|K_LINE|K_TRIM)
&& !trashcan(useron.netmail,"email"))
if(getstr(useron.netmail,LEN_NETMAIL,K_EDIT|K_AUTODEL|K_LINE|K_TRIM) < 1
|| trashcan(useron.netmail,"email")
|| ((cfg.uq & UQ_DUPNETMAIL) && userdatdupe(useron.number, U_NETMAIL, LEN_NETMAIL, useron.netmail)))
bputs(text[YouCantUseThatNetmail]);
else
break;
}
useron.misc&=~NETMAIL;
......
......@@ -127,7 +127,7 @@
#define UQ_NONETMAIL (1L<<18) /* Don't ask for e-mail/netmail address */
#define UQ_NOUPRLWR (1L<<19) /* Don't force upper/lower case strings */
#define UQ_COLORTERM (1L<<20) /* Ask if new user has color terminal */
#define UQ_DUPNETMAIL (1L<<21) /* Don't allow duplicate e-mail address */
/* Different bits in sys_misc */
#define SM_CLOSED (1L<<0) /* System is clsoed to New Users */
......
......@@ -1251,6 +1251,9 @@ void sys_cfg(void)
sprintf(opt[i++],"%-27.27s %-3.3s"
,"E-mail/NetMail Address"
,cfg.uq&UQ_NONETMAIL ? "No":"Yes");
sprintf(opt[i++],"%-27.27s %-3.3s"
,"Force Unique E-mail/NetMail Address"
,cfg.uq&UQ_DUPNETMAIL ? "Yes":"No");
sprintf(opt[i++],"%-27.27s %-3.3s"
,"Sex (Gender)"
,cfg.uq&UQ_SEX ? "Yes":"No");
......@@ -1313,42 +1316,45 @@ void sys_cfg(void)
cfg.uq^=UQ_NONETMAIL;
break;
case 7:
cfg.uq^=UQ_SEX;
cfg.uq^=UQ_DUPNETMAIL;
break;
case 8:
cfg.uq^=UQ_BIRTH;
cfg.uq^=UQ_SEX;
break;
case 9:
cfg.uq^=UQ_ADDRESS;
cfg.uq^=UQ_BIRTH;
break;
case 10:
cfg.uq^=UQ_LOCATION;
cfg.uq^=UQ_ADDRESS;
break;
case 11:
cfg.uq^=UQ_NOCOMMAS;
cfg.uq^=UQ_LOCATION;
break;
case 12:
cfg.uq^=UQ_PHONE;
cfg.uq^=UQ_NOCOMMAS;
break;
case 13:
cfg.uq^=UQ_NOEXASC;
cfg.uq^=UQ_PHONE;
break;
case 14:
cfg.uq^=UQ_XEDIT;
cfg.uq^=UQ_NOEXASC;
break;
case 15:
cfg.uq^=UQ_CMDSHELL;
cfg.uq^=UQ_XEDIT;
break;
case 16:
cfg.uq^=UQ_NODEF;
cfg.uq^=UQ_CMDSHELL;
break;
case 17:
cfg.uq^=UQ_NODEF;
break;
case 18:
cfg.uq^=UQ_COLORTERM;
break;
}
}
}
break;
}
}
}
break;
case 11: /* Advanced Options */
......
......@@ -397,7 +397,7 @@ enum {
,WhichXtrnProg
,UserRunningXtrn
,RemoveNodeLockQ
,MinimumModemSpeed
,YouCantUseThatNetmail
,NoNodeAccess
,NodeLocked
,UnknownUser
......
......@@ -641,7 +641,8 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x6e\x6f\x64\x65\x20\x25\x64\x2e\x0d\x0a\x0d\x0a\x54\x72\x79\x20\x61\x67\x61\x69\x6e\x20\x6c\x61\x74\x65\x72\x2e\x0d\x0a\x0d\x0a"
"" // 385 UserRunningXtrn
,"\x52\x65\x6d\x6f\x76\x65\x20\x6e\x6f\x64\x65\x20\x6c\x6f\x63\x6b" // 386 RemoveNodeLockQ
,"\x55\x4e\x55\x53\x45\x44\x33\x38\x37" // 387 MinimumModemSpeed
,"\x01\x6e\x59\x6f\x75\x20\x63\x61\x6e\x27\x74\x20\x75\x73\x65\x20\x74\x68\x61\x74\x20\x6d\x61\x69\x6c\x20\x61\x64\x64\x72\x65\x73"
"\x73\x20\x28\x64\x75\x70\x6c\x69\x63\x61\x74\x65\x20\x6f\x72\x20\x69\x6e\x76\x61\x6c\x69\x64\x29\x2e\x0d\x0a" // 387 YouCantUseThatNetmail
,"\x59\x6f\x75\x20\x64\x6f\x20\x6e\x6f\x74\x20\x68\x61\x76\x65\x20\x73\x75\x66\x66\x69\x63\x69\x65\x6e\x74\x20\x61\x63\x63\x65\x73"
"\x73\x20\x66\x6f\x72\x20\x74\x68\x69\x73\x20\x6e\x6f\x64\x65\x2e" // 388 NoNodeAccess
,"\x01\x6e\x01\x72\x01\x68\x0d\x0a\x53\x6f\x72\x72\x79\x2c\x20\x74\x68\x69\x73\x20\x6e\x6f\x64\x65\x20\x69\x73\x20\x74\x65\x6d\x70"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment