mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -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();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public:
|
|||
QString getDbPrefix() const { return dbPrefix; }
|
||||
void updateLoginMessage();
|
||||
protected:
|
||||
bool userExists(const QString &user);
|
||||
AuthenticationResult checkUserPassword(const QString &user, const QString &password);
|
||||
ServerInfo_User *getUserData(const QString &name);
|
||||
QList<ServerInfo_User *> getBuddyList(const QString &name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue