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

@@ -37,16 +37,32 @@ bool InterfaceDataBaseLMS::DBisConnected()
//Инструкторы
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password)
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password, ErrorAuth& error)
{
error = ErrorAuth::errNo;
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login, password))
{
if(selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id) || selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id))
if(selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id))
{
error = ErrorAuth::errArchived;
return false;
}
if(selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id))
{
error = ErrorAuth::errAlreadyLogIn;
return false;
}
if(updateUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id, true))
return true;
else
error = ErrorAuth::errDB;
}
else
error = ErrorAuth::errLoginOrPassword;
return false;
}
@@ -118,16 +134,32 @@ bool InterfaceDataBaseLMS::isLoggedInInstructor(int id)
//Инструкторы
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, ErrorAuth& error, QString classroom_name, QString computer_name)
{
error = ErrorAuth::errNo;
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login, password))
{
if(selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id) || selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id))
if(selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id))
{
error = ErrorAuth::errArchived;
return false;
}
if(selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id))
{
error = ErrorAuth::errAlreadyLogIn;
return false;
}
if(updateUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id, true))
return true;
else
error = ErrorAuth::errDB;
}
else
error = ErrorAuth::errLoginOrPassword;
return false;
}