Browse Source

Remove last sign-in time update from SignInManager

pull/24278/head
maliming 10 months ago
parent
commit
9339c92a51
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 18
      modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSignInManager.cs

18
modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSignInManager.cs

@ -1,16 +1,11 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.Timing;
namespace Volo.Abp.Identity.AspNetCore; namespace Volo.Abp.Identity.AspNetCore;
@ -94,12 +89,12 @@ public class AbpSignInManager : SignInManager<IdentityUser>
/// </summary> /// </summary>
/// <param name="user">The user</param> /// <param name="user">The user</param>
/// <returns>Null if the user should be allowed to sign in, otherwise the SignInResult why they should be denied.</returns> /// <returns>Null if the user should be allowed to sign in, otherwise the SignInResult why they should be denied.</returns>
public virtual async Task<SignInResult?> CallPreSignInCheckAsync(IdentityUser user) public virtual async Task<SignInResult> CallPreSignInCheckAsync(IdentityUser user)
{ {
return await PreSignInCheck(user); return await PreSignInCheck(user);
} }
protected override async Task<SignInResult?> PreSignInCheck(IdentityUser user) protected override async Task<SignInResult> PreSignInCheck(IdentityUser user)
{ {
if (!user.IsActive) if (!user.IsActive)
{ {
@ -133,11 +128,4 @@ public class AbpSignInManager : SignInManager<IdentityUser>
{ {
return await base.SignInOrTwoFactorAsync(user, isPersistent, loginProvider, bypassTwoFactor); return await base.SignInOrTwoFactorAsync(user, isPersistent, loginProvider, bypassTwoFactor);
} }
public override async Task SignInWithClaimsAsync(IdentityUser user, AuthenticationProperties authenticationProperties, IEnumerable<Claim> additionalClaims)
{
user.SetLastSignInTime(DateTimeOffset.UtcNow);
await UserManager.UpdateAsync(user);
await base.SignInWithClaimsAsync(user, authenticationProperties, additionalClaims);
}
} }

Loading…
Cancel
Save