Merge branch 'feature-admin-management-adm003' into feature-admin-management
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "UserInterface.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "User.h"
|
||||
|
||||
void UserInterface::run()
|
||||
{
|
||||
@@ -48,7 +49,38 @@ bool UserInterface::handleOperation(int choice)
|
||||
|
||||
void UserInterface::login()
|
||||
{
|
||||
|
||||
std::string username, password;
|
||||
util::clear();
|
||||
std::cout << "Enter username: ";
|
||||
util::read(username);
|
||||
std::cout << "Enter password: ";
|
||||
util::read(password);
|
||||
if (m_controller.login(username, password))
|
||||
{
|
||||
const User* authenticatedUser = m_controller.getAuthenticatedUser();
|
||||
if (authenticatedUser != nullptr)
|
||||
{
|
||||
switch (authenticatedUser->getUserType())
|
||||
{
|
||||
case util::UserType::ADMIN:
|
||||
m_adminMenu.showMenu();
|
||||
break;
|
||||
case util::UserType::TECHNICIAN:
|
||||
m_technicianMenu.showMenu();
|
||||
break;
|
||||
case util::UserType::CUSTOMER:
|
||||
m_customerMenu.showMenu();
|
||||
break;
|
||||
default:
|
||||
std::cout << "\nError: Unknown user type";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\nError: Invalid Username or Password";
|
||||
}
|
||||
}
|
||||
|
||||
void UserInterface::registerCustomer()
|
||||
|
||||
Reference in New Issue
Block a user