Add email registration restriction (#2350)

* Add ability to limit number of account registrations with same email address

This commit adds server side functionality that will allow operators to
limit the number of accounts that can be registered to the server with
the same email address.

* Updated ini wording

Updated configuration file wording for better description.
This commit is contained in:
woogerboy21 2017-01-07 11:26:23 -05:00 committed by GitHub
parent 3e39432ccc
commit a85b0dcbba
8 changed files with 37 additions and 2 deletions

View file

@ -1109,3 +1109,22 @@ QList<ServerInfo_ChatMessage> Servatrice_DatabaseInterface::getMessageLogHistory
return results;
}
int Servatrice_DatabaseInterface::checkNumberOfUserAccounts(const QString &email)
{
if (!checkSql())
return 0;
QSqlQuery *query = prepareQuery("SELECT count(email) FROM {prefix}_users WHERE email = :user_email");
query->bindValue(":user_email", email);
if (!execSqlQuery(query)) {
qDebug("Failed to identify the number of users accounts for users email address: SQL Error");
return 0;
}
if (query->next())
return query->value(0).toInt();
return 0;
}