mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
login consistency fix; limit length of user names to 35
This commit is contained in:
parent
a4552a1596
commit
102e246c6d
5 changed files with 27 additions and 2 deletions
|
|
@ -170,6 +170,25 @@ AuthenticationResult Servatrice::checkUserPassword(const QString &user, const QS
|
|||
return UnknownUser;
|
||||
}
|
||||
|
||||
bool Servatrice::userExists(const QString &user)
|
||||
{
|
||||
const QString method = settings->value("authentication/method").toString();
|
||||
if (method == "sql") {
|
||||
checkSql();
|
||||
|
||||
QSqlQuery query;
|
||||
query.prepare("select 1 from " + dbPrefix + "_users where name = :name");
|
||||
query.bindValue(":name", user);
|
||||
qDebug() << "a";
|
||||
if (!execSqlQuery(query))
|
||||
return false;
|
||||
qDebug() << "b";
|
||||
bool res = query.next();
|
||||
qDebug() << res << user;
|
||||
return res;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
ServerInfo_User *Servatrice::evalUserQueryResult(const QSqlQuery &query, bool complete)
|
||||
{
|
||||
QString name = query.value(0).toString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue