mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Контроль целостности логинов юзеров
This commit is contained in:
@@ -24,6 +24,13 @@ EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminM
|
||||
ui->btnArchive->click();
|
||||
|
||||
waitAnimationWidget->setParent(this);
|
||||
|
||||
ui->btnNewGroup->setEnabled(true);
|
||||
ui->btnDeleteGroup->setEnabled(false);
|
||||
ui->btnNewTrainee->setEnabled(false);
|
||||
ui->btnDeleteTrainee->setEnabled(false);
|
||||
ui->btnToOrFromArchiveTrainee->setEnabled(false);
|
||||
ui->btnEdit->setEnabled(false);
|
||||
}
|
||||
|
||||
EditorTrainees::~EditorTrainees()
|
||||
@@ -448,7 +455,7 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
|
||||
{
|
||||
//Проверка корректности логина, имени, пароля
|
||||
|
||||
if(trainee.getName() == QStringLiteral("<trainee>"))
|
||||
if(trainee.getName() == QStringLiteral("<name>"))
|
||||
{//Имя не корректно!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted."));
|
||||
@@ -469,23 +476,14 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Trainee> listTrainees = connectorToServer->getListTrainees();
|
||||
|
||||
for(Trainee exist_trainee : listTrainees)
|
||||
{
|
||||
if(trainee.getName() == exist_trainee.getName() && trainee.getID() != exist_trainee.getID())
|
||||
{//Имя уже существует
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("An existing trainee name has been entered."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(trainee.getLogin() == exist_trainee.getLogin() && trainee.getID() != exist_trainee.getID())
|
||||
{//Логин уже существует!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("An existing trainee login has been entered.\nThe changes will not be accepted."));
|
||||
return false;
|
||||
}
|
||||
int user_I = connectorToServer->getIdInstructorByLogin(trainee.getLogin());
|
||||
int user_T = connectorToServer->getIdTraineeByLogin(trainee.getLogin());
|
||||
if((user_I && (user_I != trainee.getID())) || (user_T && (user_T != trainee.getID())))
|
||||
{//Логин уже существует!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user