示例#1
0
        public async ValueTask HandleAsync(ChangePasswordCommand command, CancellationToken cancellationToken = default)
        {
            ValidationParameter.FailIfNull(command);

            // to do get session which will be get from headers, implementation after add headers

            var customer = await _customerService.GetCustomerAsync(command.Username);

            _customerService.ValidateCustomerAccountAsync(customer);

            var activeUserPassword = await _passwordHelper.GetActivePassword(customer);

            //compare old password and new password. New password can not be exactly same like old password
            _passwordHelper.ComaprePasswords(activeUserPassword, command.NewPassword);

            await _passwordHelper.RemoveOldPassword(command.Username);

            await _passwordHelper.SetPassword(command.NewPassword, customer);
        }