Browse Source

Add setting to enable password reuse prevention

pull/23907/head
maliming 12 months ago
parent
commit
62d6331042
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 1
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs
  2. 7
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs
  3. 9
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs

1
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.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";
}

7
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs

@ -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(),

9
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs

@ -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"/>.

Loading…
Cancel
Save