Skip to content

Commit

Permalink
Merge pull request #154 from takuabonn/feature/153
Browse files Browse the repository at this point in the history
Fixes crash on Create User / Forgot User Flow with empty password.
  • Loading branch information
apexdodge authored Dec 4, 2023
2 parents c2a576f + 88179ca commit 982ddec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Validator(IRaythaDbContext db)
RuleFor(x => x.Id).NotEmpty();
RuleFor(x => x).Custom((request, context) =>
{
if (request.NewPassword.Length < PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH)
if (string.IsNullOrEmpty(request.NewPassword) || request.NewPassword.Length < PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH)
{
context.AddFailure("NewPassword", $"Password must be at least {PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH} characters.");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Raytha.Application/Login/Commands/CreateUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Validator(IRaythaDbContext db)
RuleFor(x => x.EmailAddress).NotEmpty().EmailAddress();
RuleFor(x => x).Custom((request, context) =>
{
if (request.Password.Length < PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH)
if (string.IsNullOrEmpty(request.Password) || request.Password.Length < PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH)
{
context.AddFailure("Password", $"Password must be at least {PasswordUtility.PASSWORD_MIN_CHARACTER_LENGTH} characters.");
return;
Expand Down

0 comments on commit 982ddec

Please sign in to comment.