fix: set correct password condition

This commit is contained in:
Polianin Nikita 2024-09-07 04:18:04 +03:00
parent ae0f437e2c
commit 6f9bfd3880

View File

@ -211,7 +211,7 @@ public class SetupController(
[BadRequestResponse] [BadRequestResponse]
public ActionResult<string> CreateAdmin([FromBody] CreateUserRequest user) public ActionResult<string> CreateAdmin([FromBody] CreateUserRequest user)
{ {
if (PasswordHashService.HasPasswordInPolicySecurity(user.Password)) if (!PasswordHashService.HasPasswordInPolicySecurity(user.Password))
throw new ControllerArgumentException("The password must be at least 8 characters long and contain at least one uppercase letter and one special character."); throw new ControllerArgumentException("The password must be at least 8 characters long and contain at least one uppercase letter and one special character.");
if (!MailAddress.TryCreate(user.Email, out _)) if (!MailAddress.TryCreate(user.Email, out _))