Improved login error message
This commit is contained in:
parent
a6ff54ae0e
commit
beecc0f970
5 changed files with 17 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <iostream>
|
||||
#include "dlg_connect.h"
|
||||
#include "settingscache.h"
|
||||
|
@ -149,6 +150,12 @@ void DlgConnect::actOk()
|
|||
settingsCache->servers().setPreviousHostList(hostList);
|
||||
settingsCache->servers().setPrevioushostindex(previousHosts->currentIndex());
|
||||
|
||||
if(playernameEdit->text().isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Connect Warning"), tr("The player name can't be empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
|
|
|
@ -361,6 +361,11 @@ void DlgRegister::actOk()
|
|||
QMessageBox::critical(this, tr("Registration Warning"), tr("Your email addresses do not match, please try again."));
|
||||
return;
|
||||
}
|
||||
if(playernameEdit->text().isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Registration Warning"), tr("The player name can't be empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
settingsCache->servers().setHostName(hostEdit->text());
|
||||
settingsCache->servers().setPort(portEdit->text());
|
||||
|
|
|
@ -387,7 +387,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
|||
QString clientId = QString::fromStdString(cmd.clientid()).simplified();
|
||||
QString clientVersion = QString::fromStdString(cmd.clientver()).simplified();
|
||||
|
||||
if (userName.isEmpty() || (userInfo != 0))
|
||||
if (userInfo != 0)
|
||||
return Response::RespContextError;
|
||||
|
||||
// check client feature set against server feature set
|
||||
|
|
|
@ -176,7 +176,8 @@ bool Servatrice::initServer()
|
|||
bool registrationEnabled = settingsCache->value("registration/enabled", false).toBool();
|
||||
bool requireEmailForRegistration = settingsCache->value("registration/requireemail", true).toBool();
|
||||
|
||||
qDebug() << "Registration enabled: " << regServerOnly;
|
||||
qDebug() << "Accept registered users only: " << regServerOnly;
|
||||
qDebug() << "Registration enabled: " << registrationEnabled;
|
||||
if (registrationEnabled)
|
||||
qDebug() << "Require email address to register: " << requireEmailForRegistration;
|
||||
|
||||
|
|
|
@ -124,6 +124,8 @@ bool Servatrice_DatabaseInterface::execSqlQuery(QSqlQuery *query)
|
|||
bool Servatrice_DatabaseInterface::usernameIsValid(const QString &user, QString & error)
|
||||
{
|
||||
int minNameLength = settingsCache->value("users/minnamelength", 6).toInt();
|
||||
if(minNameLength < 1)
|
||||
minNameLength = 1;
|
||||
int maxNameLength = settingsCache->value("users/maxnamelength", 12).toInt();
|
||||
bool allowLowercase = settingsCache->value("users/allowlowercase", true).toBool();
|
||||
bool allowUppercase = settingsCache->value("users/allowuppercase", true).toBool();
|
||||
|
|
Loading…
Reference in a new issue