Skip to content

Commit

Permalink
fix: remove password expired check
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev committed Feb 7, 2024
1 parent dee2929 commit 564f1b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using VirtoCommerce.Platform.Security.Model;
Expand All @@ -14,32 +15,16 @@ public Task<IList<TokenLoginResponse>> ValidateUserAsync(SignInValidatorContext

if (!context.IsSucceeded)
{
result.Add(SecurityErrorDescriber.LoginFailed());
if (!context.DetailedErrors)
{
result.Add(SecurityErrorDescriber.LoginFailed());
}
else if (context.IsLockedOut)
{
var permanentLockOut = context.User.LockoutEnd == DateTime.MaxValue.ToUniversalTime();
result.Add(permanentLockOut ? SecurityErrorDescriber.UserIsLockedOut() : SecurityErrorDescriber.UserIsTemporaryLockedOut());
}
}
else if (context.User.PasswordExpired)
{
result.Add(SecurityErrorDescriber.PasswordExpired());
}

//if (!context.IsSucceeded)
//{
// if (!context.DetailedErrors)
// {
// result.Add(SecurityErrorDescriber.LoginFailed());
// }
// else if (context.IsLockedOut)
// {
// var permanentLockOut = context.User.LockoutEnd == DateTime.MaxValue.ToUniversalTime();
// result.Add(permanentLockOut ? SecurityErrorDescriber.UserIsLockedOut() : SecurityErrorDescriber.UserIsTemporaryLockedOut());
// }
//}
//else
//{
// if (context.User.PasswordExpired)
// {
// result.Add(SecurityErrorDescriber.PasswordExpired());
// }
//}

return Task.FromResult<IList<TokenLoginResponse>>(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public async Task<ActionResult> Exchange()

var context = new SignInValidatorContext
{
User = user,
User = user.Clone() as ApplicationUser,
DetailedErrors = _passwordLoginOptions.DetailedErrors,
IsSucceeded = result.Succeeded,
IsLockedOut = result.IsLockedOut,
Expand Down

0 comments on commit 564f1b6

Please sign in to comment.