GUI.Тип ошибки авторизации

This commit is contained in:
2025-11-27 16:54:40 +03:00
parent 00c9ec8893
commit bf87a2c982
13 changed files with 182 additions and 42 deletions

View File

@@ -54,6 +54,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
connect(connectorToServer, &ConnectorToServer::sigLoginResult, this, &InstructorsAndTraineesWidget::slot_checkLoginResult);
connect(connectorToServer, &ConnectorToServer::sigDeLoginResult, this, &InstructorsAndTraineesWidget::slot_checkDeLoginResult);
connect(connectorToServer, &ConnectorToServer::sigServerBlocked, this, &InstructorsAndTraineesWidget::slot_ServerBlocked);
connect(connectorToServer, &ConnectorToServer::sigErrorAuth, this, &InstructorsAndTraineesWidget::slot_ErrorAuth);
connect(connectorToServer,&ConnectorToServer::signal_AnswerDocsChanged,this, &InstructorsAndTraineesWidget::slot_AnswerDocsChanged);
messangerController = new MessangerController(connectorToServer, this);
@@ -239,16 +240,14 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se
viewerInstructors->activate();
waitAnimationWidget->hideWithStop();
flTryLogin = false;
}
else
{
waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor authorization.") + "\n" + tr("Invalid login or password!")).exec();
//waitAnimationWidget->hideWithStop();
//ui->btnAuthorizationInstructor->setChecked(false);
}
flTryLogin = false;
}
void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization *serverDeAuth)
@@ -285,7 +284,39 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked()
waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Server blocked!")).exec();
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + tr("Server blocked!")).exec();
}
}
void InstructorsAndTraineesWidget::slot_ErrorAuth(QString error)
{
if(flTryLogin)
{
flTryLogin = false;
waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false);
QString errorTextMsg = "";
if(error == NOTIFY_ERROR_AUTH_DB)
{
errorTextMsg = tr("Database error!");
}
else if(error == NOTIFY_ERROR_AUTH_ARCHIVED)
{
errorTextMsg = tr("The user is archived!");
}
else if(error == NOTIFY_ERROR_AUTH_ALREADYLOGIN)
{
errorTextMsg = tr("The user is already logged in!");
}
else if(error == NOTIFY_ERROR_AUTH_LOGINORPASSWORD)
{
errorTextMsg = tr("Login or password error!");
}
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + errorTextMsg).exec();
}
}