feat: Hide login button and disable input edit when login locked.
This commit is contained in:
@@ -184,14 +184,17 @@ void LoginDialog::clearInputData()
|
||||
|
||||
void LoginDialog::doLogin()
|
||||
{
|
||||
if (!(AppGlobalValues::DBconnected().toBool())){
|
||||
|
||||
if (!(AppGlobalValues::DBconnected().toBool()))
|
||||
{
|
||||
mErrorMessage->setText(QString(tr("Can't connect db. Please reboot the device and retry, or call for the service help.")).arg(LOGIN_LOCK_MINUTIES));
|
||||
mErrorMessage->setVisible(true);
|
||||
return;
|
||||
}
|
||||
if(mLoginFailedCount >= LOGIN_LOCK_COUNT)
|
||||
{
|
||||
mAccountEdit->setEnabled(false);
|
||||
mPasswordEdit->setEnabled(false);
|
||||
mLoginButton->setVisible(false);
|
||||
mErrorMessage->setText(QString(tr("Login locked. Please retry after %1 minutes.")).arg(LOGIN_LOCK_MINUTIES));
|
||||
mErrorMessage->setVisible(true);
|
||||
return;
|
||||
@@ -201,7 +204,7 @@ void LoginDialog::doLogin()
|
||||
QString strPassWord = mPasswordEdit->text();
|
||||
|
||||
QString encryptedPassword = strPassWord;
|
||||
// strPassWord = "123456";
|
||||
//strPassWord = "123456";
|
||||
|
||||
QString encryptPwd = User::getEncryptedPassword(strPassWord);
|
||||
if (User::QueryUser(strUserCode, encryptPwd))
|
||||
@@ -257,6 +260,10 @@ void LoginDialog::showEvent(QShowEvent* event)
|
||||
|
||||
void LoginDialog::resetLoginFailedCount()
|
||||
{
|
||||
mAccountEdit->setEnabled(true);
|
||||
mPasswordEdit->setEnabled(true);
|
||||
mLoginButton->setVisible(true);
|
||||
mErrorMessage->setVisible(false);
|
||||
mLoginFailedCount = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user