Browse Source
Add `ShouldChangePasswordOnNextLogin` to `IdenttiyUser`.
pull/15708/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
16 additions and
0 deletions
-
modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpSignInManager.cs
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs
|
|
|
@ -85,6 +85,12 @@ public class AbpSignInManager : SignInManager<IdentityUser> |
|
|
|
return SignInResult.NotAllowed; |
|
|
|
} |
|
|
|
|
|
|
|
if (user.ShouldChangePasswordOnNextLogin) |
|
|
|
{ |
|
|
|
Logger.LogWarning($"The user should change password! (username: \"{user.UserName}\", id:\"{user.Id}\")"); |
|
|
|
return SignInResult.NotAllowed; |
|
|
|
} |
|
|
|
|
|
|
|
return await base.PreSignInCheck(user); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -112,6 +112,11 @@ public class IdentityUser : FullAuditedAggregateRoot<Guid>, IUser, IHasEntityVer |
|
|
|
/// </summary>
|
|
|
|
public virtual int AccessFailedCount { get; protected internal set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Should change password on next login.
|
|
|
|
/// </summary>
|
|
|
|
public virtual bool ShouldChangePasswordOnNextLogin { get; protected internal set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A version value that is increased whenever the entity is changed.
|
|
|
|
/// </summary>
|
|
|
|
@ -368,6 +373,11 @@ public class IdentityUser : FullAuditedAggregateRoot<Guid>, IUser, IHasEntityVer |
|
|
|
IsActive = isActive; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void SetShouldChangePasswordOnNextLogin(bool shouldChangePasswordOnNextLogin) |
|
|
|
{ |
|
|
|
ShouldChangePasswordOnNextLogin = shouldChangePasswordOnNextLogin; |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
return $"{base.ToString()}, UserName = {UserName}"; |
|
|
|
|