2020-12-06 10:46:04 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2021-07-05 14:27:49 +01:00
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Core.Configuration.Models
|
2020-03-16 14:02:08 +01:00
|
|
|
{
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Typed configuration options for user password settings.
|
|
|
|
|
/// </summary>
|
2021-06-24 08:47:37 +02:00
|
|
|
[UmbracoOptions(Constants.Configuration.ConfigUserPassword)]
|
2020-08-20 22:18:50 +01:00
|
|
|
public class UserPasswordConfigurationSettings : IPasswordConfiguration
|
2020-03-16 14:02:08 +01:00
|
|
|
{
|
2021-07-05 14:27:49 +01:00
|
|
|
internal const int StaticRequiredLength = 10;
|
|
|
|
|
internal const bool StaticRequireNonLetterOrDigit = false;
|
|
|
|
|
internal const bool StaticRequireDigit = false;
|
|
|
|
|
internal const bool StaticRequireLowercase = false;
|
|
|
|
|
internal const bool StaticRequireUppercase = false;
|
|
|
|
|
internal const int StaticMaxFailedAccessAttemptsBeforeLockout = 5;
|
|
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticRequiredLength)]
|
|
|
|
|
public int RequiredLength { get; set; } = StaticRequiredLength;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticRequireNonLetterOrDigit)]
|
|
|
|
|
public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit;
|
2020-03-16 14:02:08 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticRequireDigit)]
|
|
|
|
|
public bool RequireDigit { get; set; } = StaticRequireDigit;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticRequireLowercase)]
|
|
|
|
|
public bool RequireLowercase { get; set; } = StaticRequireLowercase;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticRequireUppercase)]
|
|
|
|
|
public bool RequireUppercase { get; set; } = StaticRequireUppercase;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)]
|
2020-08-20 08:24:23 +01:00
|
|
|
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName;
|
2020-03-18 11:29:29 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <inheritdoc/>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)]
|
|
|
|
|
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout;
|
2020-03-16 14:02:08 +01:00
|
|
|
}
|
|
|
|
|
}
|