fixed blocking important issues
This commit is contained in:
@@ -36,7 +36,7 @@ func (s *customerService) AdminResetPassword(ctx context.Context, actorID, targe
|
||||
|
||||
customer, err := s.repository.GetByID(ctx, targetID)
|
||||
if err != nil {
|
||||
if err.Error() == "customer not found" {
|
||||
if errors.Is(err, ErrCustomerNotFound) {
|
||||
return nil, errCustomerNotFound
|
||||
}
|
||||
s.logger.Error("Failed to load customer for password reset", map[string]interface{}{
|
||||
@@ -68,9 +68,10 @@ func (s *customerService) AdminResetPassword(ctx context.Context, actorID, targe
|
||||
return nil, errCustResetPasswordFailed
|
||||
}
|
||||
|
||||
customer.Password = string(hashedPassword)
|
||||
customer.UpdatedBy = &actorID
|
||||
if err := s.repository.Update(ctx, customer); err != nil {
|
||||
if err := s.repository.UpdatePasswordReset(ctx, targetID, string(hashedPassword), actorID); err != nil {
|
||||
if errors.Is(err, ErrCustomerNotFound) {
|
||||
return nil, errCustomerNotFound
|
||||
}
|
||||
s.logger.Error("Failed to persist reset password", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
"customer_id": targetID,
|
||||
@@ -83,7 +84,6 @@ func (s *customerService) AdminResetPassword(ctx context.Context, actorID, targe
|
||||
"error": err.Error(),
|
||||
"customer_id": targetID,
|
||||
})
|
||||
return nil, errCustResetPasswordFailed
|
||||
}
|
||||
|
||||
s.auditLogger.Log(ctx, audit.Entry{
|
||||
|
||||
Reference in New Issue
Block a user