Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PT-82: Configuration of password expiration policy #2193

Merged
merged 9 commits into from Mar 30, 2021
6 changes: 6 additions & 0 deletions src/VirtoCommerce.Platform.Core/Security/ApplicationUser.cs
Expand Up @@ -62,6 +62,11 @@ public class ApplicationUser : IdentityUser, IEntity, IAuditable, ICloneable
/// </summary>
public virtual bool PasswordExpired { get; set; }

/// <summary>
/// The last date when the password was changed
/// </summary>
public virtual DateTime? LastPasswordChangedDate { get; set; }

public virtual void Patch(ApplicationUser target)
{
target.UserName = UserName;
Expand All @@ -87,6 +92,7 @@ public virtual void Patch(ApplicationUser target)
target.Status = Status;
target.Password = Password;
target.PasswordExpired = PasswordExpired;
target.LastPasswordChangedDate = LastPasswordChangedDate;
}

#region ICloneable members
Expand Down
17 changes: 17 additions & 0 deletions src/VirtoCommerce.Platform.Core/Security/UserOptionsExtended.cs
@@ -0,0 +1,17 @@
using System;

namespace VirtoCommerce.Platform.Core.Security
{
public class UserOptionsExtended
{
/// <summary>
/// Max. valid time for a password. Property that has the null as default value. Null value means what the password never expires.
/// </summary>
public TimeSpan? MaxPasswordAge { get; set; }

/// <summary>
/// The number of days to start showing password expiry reminder
/// </summary>
public int RemindPasswordExpiryInDays { get; set; } = 7;
}
}