Merge branch 'feature-customer-management-cus003' into feature-customer-management

This commit is contained in:
2026-05-21 13:07:58 +05:30
3 changed files with 25 additions and 0 deletions
@@ -12,6 +12,7 @@ void Controller::logout()
void Controller::changePassword(const std::string& newPassword)
{
m_authenticationManagementService.changePassword(newPassword);
}
void Controller::createCustomer(const std::string& username, const std::string& password, const std::string& email, const std::string& phone)
@@ -1,3 +1,4 @@
#include <stdexcept>
#include "AuthenticationManagementService.h"
#include "User.h"
@@ -32,3 +33,12 @@ void AuthenticationManagementService::logout()
{
m_authenticatedUser = nullptr;
}
void AuthenticationManagementService::changePassword(const std::string& newPassword)
{
if (m_authenticatedUser == nullptr)
{
throw std::runtime_error("There is no user currently logged in!");
}
m_authenticatedUser->setPassword(newPassword);
}
@@ -1,6 +1,7 @@
#include "CustomerMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "Validator.h"
void CustomerMenu::showMenu()
{
@@ -38,6 +39,19 @@ void CustomerMenu::logout()
void CustomerMenu::changePassword()
{
std::string newPassword;
util::clear();
std::cout << "Enter new password: ";
util::read(newPassword);
m_controller.changePassword(newPassword);
if (!util::isPasswordValid(newPassword))
{
std::cout << "Error: Password is not strong enough!";
util::pressEnter();
return;
}
std::cout << "Password changed successfully";
util::pressEnter();
}
void CustomerMenu::updateDetails()