Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Wrong message for password policies #649

@RomainL972

Description

@RomainL972

PassCore Server

  • OS: Windows
  • Provider: Active Directory

Describe the bug
When I try to change my password but my password policies don't accept the new password (ex. password too recent), the error message I get is "Failed due to password complex policies: New password length is shorter than AD minimum password length".

To Reproduce
Steps to reproduce the behavior:

  1. Have a Windows Server (2019) with default security policies
  2. Change the password of user 'test'
  3. Install PassCore
  4. Try to change the password of user 'test' again

Expected behavior
There should have been an error message saying there was an error due to my password policies, instead of a message "my new password is too short"

Desktop (please complete the following information):

  • OS: Arch Linux
  • Browser: Mozilla Firefox
  • Version: 91.0.1

Additional context
It seems to be because when there is a PasswordException during the password change, it returns the same error as when the password is too short:

catch (PasswordException passwordEx)
{
var item = new ApiErrorItem(ApiErrorCode.ComplexPassword, passwordEx.Message);
_logger.LogWarning(item.Message, passwordEx);
return item;
}

When the password is too short:
if (newPassword.Length < minPwdLength)
{
_logger.LogError("Failed due to password complex policies: New password length is shorter than AD minimum password length");
return new ApiErrorItem(ApiErrorCode.ComplexPassword);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions