login consistency fix; limit length of user names to 35

This commit is contained in:
Max-Wilhelm Bruker 2011-02-23 23:46:18 +01:00
parent a4552a1596
commit 102e246c6d
5 changed files with 27 additions and 2 deletions

View file

@ -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();