mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Added registration email blacklist (#2352)
* Added registration email blacklist Added the ability to define email blacklist for user registration. Now server operators can prevent users from registering accounts that contain providers they do not wish users to use. * Update ini option for clarity Updated servatrice ini option name for clarity. * Updated description for clarity Added implicit explination
This commit is contained in:
parent
dab731656d
commit
0fdb9b7c83
6 changed files with 30 additions and 0 deletions
|
|
@ -881,7 +881,19 @@ Response::ResponseCode AbstractServerSocketInterface::cmdRegisterAccount(const C
|
|||
if (!registrationEnabled)
|
||||
return Response::RespRegistrationDisabled;
|
||||
|
||||
QString emailBlackList = servatrice->getEmailBlackList();
|
||||
QString emailAddress = QString::fromStdString(cmd.email());
|
||||
QStringList emailBlackListFilters = emailBlackList.split(",", QString::SkipEmptyParts);
|
||||
|
||||
// verify that users email/provider is not blacklisted
|
||||
if (!emailBlackList.trimmed().isEmpty()) {
|
||||
foreach(QString blackListEmailAddress, emailBlackListFilters) {
|
||||
if (emailAddress.contains(blackListEmailAddress, Qt::CaseInsensitive)) {
|
||||
return Response::RespEmailBlackListed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool requireEmailForRegistration = settingsCache->value("registration/requireemail", true).toBool();
|
||||
if (requireEmailForRegistration)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue