mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-31 08:00:25 -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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user