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:
woogerboy21 2017-02-08 15:25:27 -05:00 committed by GitHub
parent dab731656d
commit 0fdb9b7c83
6 changed files with 30 additions and 0 deletions

View file

@ -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)
{