Browse Source
Add setting to enable password reuse prevention
pull/23907/head
maliming
12 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
3 changed files with
17 additions and
0 deletions
-
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs
|
|
|
@ -16,6 +16,7 @@ public static class IdentitySettingNames |
|
|
|
public const string RequireDigit = PasswordPrefix + ".RequireDigit"; |
|
|
|
public const string ForceUsersToPeriodicallyChangePassword = PasswordPrefix + ".ForceUsersToPeriodicallyChangePassword"; |
|
|
|
public const string PasswordChangePeriodDays = PasswordPrefix + ".PasswordChangePeriodDays"; |
|
|
|
public const string EnablePreventPasswordReuse = PasswordPrefix + ".EnablePreventPasswordReuse"; |
|
|
|
public const string PreventPasswordReuseCount = PasswordPrefix + ".PreventPasswordReuseCount"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -66,6 +66,13 @@ public class AbpIdentitySettingDefinitionProvider : SettingDefinitionProvider |
|
|
|
L("Description:Abp.Identity.Password.PasswordChangePeriodDays"), |
|
|
|
true), |
|
|
|
|
|
|
|
new SettingDefinition( |
|
|
|
IdentitySettingNames.Password.EnablePreventPasswordReuse, |
|
|
|
false.ToString(), |
|
|
|
L("DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse"), |
|
|
|
L("Description:Abp.Identity.Password.EnablePreventPasswordReuse"), |
|
|
|
true), |
|
|
|
|
|
|
|
new SettingDefinition( |
|
|
|
IdentitySettingNames.Password.PreventPasswordReuseCount, |
|
|
|
6.ToString(), |
|
|
|
|
|
|
|
@ -351,6 +351,15 @@ public class IdentityUser : FullAuditedAggregateRoot<Guid>, IUser, IHasEntityVer |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual void AddPasswordHistory(string password) |
|
|
|
{ |
|
|
|
PasswordHistories.Add(new IdentityUserPasswordHistory( |
|
|
|
Id, |
|
|
|
password, |
|
|
|
TenantId) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Use <see cref="IdentityUserManager.ConfirmEmailAsync"/> for regular email confirmation.
|
|
|
|
/// Using this skips the confirmation process and directly sets the <see cref="EmailConfirmed"/>.
|
|
|
|
|