diff --git a/BeReadyBackend/Endpoints/Users/PatchUserPasswordEndpoint.cs b/BeReadyBackend/Endpoints/Users/PatchUserPasswordEndpoint.cs index ae4416c..adbbca4 100644 --- a/BeReadyBackend/Endpoints/Users/PatchUserPasswordEndpoint.cs +++ b/BeReadyBackend/Endpoints/Users/PatchUserPasswordEndpoint.cs @@ -28,6 +28,7 @@ public class PatchUserPasswordEndpoint(UsersRepository usersRepository, UserServ } string salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next(); + user.Salt = salt; user.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + salt); await usersRepository.SaveChangesAsync(ct); diff --git a/BeReadyBackend/Endpoints/Users/UpdateUserEndpoint.cs b/BeReadyBackend/Endpoints/Users/UpdateUserEndpoint.cs index 04e537f..3d5364a 100644 --- a/BeReadyBackend/Endpoints/Users/UpdateUserEndpoint.cs +++ b/BeReadyBackend/Endpoints/Users/UpdateUserEndpoint.cs @@ -39,5 +39,6 @@ public class UpdateUserEndpoint(UsersRepository usersRepository, UserService use await usersRepository.SaveChangesAsync(ct); await Send.NoContentAsync(ct); + await Send.OkAsync(await usersRepository.ProjectToSingleAsync(new GetUserByIdSpec(userId), ct), ct); } } \ No newline at end of file diff --git a/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs b/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs index e944904..10bd91e 100644 --- a/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs +++ b/BeReadyBackend/Validators/Users/PatchUserPasswordDtoValidator.cs @@ -12,6 +12,7 @@ public class PatchUserPasswordDtoValidator : Validator .NotEmpty() .WithMessage("Password is required") .MinimumLength(12) - .WithMessage("Password must exceed 12 characters"); + .WithMessage("Password must exceed 12 characters") + .Matches(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*?[#?_!@$%^&*-])"); } } \ No newline at end of file