Merged PR 896: UserStory AUTH003 Logout
Related work items: #932, #935, #936
This commit is contained in:
@@ -8,6 +8,7 @@ AuthenticationContext ZenvyController::login(const std::string& email, const std
|
|||||||
|
|
||||||
void ZenvyController::logout()
|
void ZenvyController::logout()
|
||||||
{
|
{
|
||||||
|
m_authenticationManagementService->logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZenvyController::changePassword(const std::string& password) const
|
void ZenvyController::changePassword(const std::string& password) const
|
||||||
|
|||||||
@@ -24,4 +24,10 @@ void DataStore::setAuthenticatedEmployee(std::shared_ptr<Employee> authenticated
|
|||||||
employeeMap& DataStore::getEmployees()
|
employeeMap& DataStore::getEmployees()
|
||||||
{
|
{
|
||||||
return m_employees;
|
return m_employees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Employee>& DataStore::getAuthenticatedUser()
|
||||||
|
{
|
||||||
|
return m_authenticatedEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
DataStore(DataStore&&) = delete;
|
DataStore(DataStore&&) = delete;
|
||||||
DataStore& operator=(DataStore&&) = delete;
|
DataStore& operator=(DataStore&&) = delete;
|
||||||
employeeMap& getEmployees();
|
employeeMap& getEmployees();
|
||||||
|
std::shared_ptr<Employee>& getAuthenticatedUser();
|
||||||
logMap& getLogs();
|
logMap& getLogs();
|
||||||
std::shared_ptr<Employee>& getAuthenticatedEmployee();
|
std::shared_ptr<Employee>& getAuthenticatedEmployee();
|
||||||
void setAuthenticatedEmployee(std::shared_ptr < Employee>);
|
void setAuthenticatedEmployee(std::shared_ptr < Employee>);
|
||||||
|
|||||||
@@ -59,3 +59,12 @@ void AuthenticationManagementService::changePassword(const std::string& password
|
|||||||
throw std::runtime_error("User not found");
|
throw std::runtime_error("User not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuthenticationManagementService::logout() {
|
||||||
|
if (m_dataStore.getAuthenticatedUser()) {
|
||||||
|
m_dataStore.getAuthenticatedUser() = nullptr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw std::runtime_error("No user currently logged In...");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user