diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs
index 6239af36e0..d7d26e02e1 100644
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs
+++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs
@@ -261,7 +261,7 @@ public class IdentityUserStore :
/// The password hash to set.
/// The used to propagate notifications that the operation should be canceled.
/// The that represents the asynchronous operation.
- public virtual async Task SetPasswordHashAsync([NotNull] IdentityUser user, string passwordHash, CancellationToken cancellationToken = default)
+ public virtual Task SetPasswordHashAsync([NotNull] IdentityUser user, string passwordHash, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -269,10 +269,9 @@ public class IdentityUserStore :
user.PasswordHash = passwordHash;
- if (await FindByIdAsync(user.Id.ToString(), cancellationToken) != null)
- {
- user.SetLastPasswordChangeTime(DateTime.UtcNow);
- }
+ user.SetLastPasswordChangeTime(DateTime.UtcNow);
+
+ return Task.CompletedTask;
}
///
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs
index 8949d7dafd..34f933ced4 100644
--- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs
+++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs
@@ -3,10 +3,12 @@ using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Identity.Localization;
+using Volo.Abp.Identity.Settings;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.Identity;
+using Volo.Abp.Settings;
using Volo.Abp.Threading;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.Uow;
@@ -49,6 +51,11 @@ public class AbpIdentityDomainTestModule : AbpModule
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
+
+ Configure(options =>
+ {
+ options.ValueProviders.Add();
+ });
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs
index 29b51a9b54..517313abcd 100644
--- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs
+++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Shouldly;
+using Volo.Abp.Identity.Settings;
using Volo.Abp.Uow;
using Xunit;
@@ -214,6 +215,40 @@ public class IdentityUserManager_Tests : AbpIdentityDomainTestBase
}
}
+ [Fact]
+ public async Task ShouldPeriodicallyChangePasswordAsync_Return_False()
+ {
+ var user = CreateRandomUser();
+ AddPeriodicallyChangePasswordSettings();
+
+ (await _identityUserManager.CreateAsync(user)).CheckErrors();
+ (await _identityUserManager.ShouldPeriodicallyChangePasswordAsync(user)).ShouldBeFalse();
+
+ await _identityUserManager.AddPasswordAsync(user, IdentityDataSeedContributor.AdminPasswordDefaultValue);
+ (await _identityUserManager.ShouldPeriodicallyChangePasswordAsync(user)).ShouldBeFalse();
+
+ user.CreationTime = DateTime.Now;
+ user.SetLastPasswordChangeTime(null);
+ (await _identityUserManager.ShouldPeriodicallyChangePasswordAsync(user)).ShouldBeFalse();
+ }
+
+ [Fact]
+ public async Task ShouldPeriodicallyChangePasswordAsync_Return_True()
+ {
+ var user = CreateRandomUser();
+ AddPeriodicallyChangePasswordSettings();
+
+ (await _identityUserManager.CreateAsync(user)).CheckErrors();
+ await _identityUserManager.AddPasswordAsync(user, IdentityDataSeedContributor.AdminPasswordDefaultValue);
+
+ user.SetLastPasswordChangeTime(DateTime.UtcNow.AddDays(-3));
+ (await _identityUserManager.ShouldPeriodicallyChangePasswordAsync(user)).ShouldBeTrue();
+
+ user.CreationTime = DateTime.Now.AddDays(-3);
+ user.SetLastPasswordChangeTime(null);
+ (await _identityUserManager.ShouldPeriodicallyChangePasswordAsync(user)).ShouldBeTrue();
+ }
+
private async Task CreateRandomDefaultRoleAsync()
{
await _identityRoleRepository.InsertAsync(
@@ -235,4 +270,10 @@ public class IdentityUserManager_Tests : AbpIdentityDomainTestBase
Guid.NewGuid().ToString() + "@abp.io"
);
}
+
+ private static void AddPeriodicallyChangePasswordSettings()
+ {
+ TestSettingValueProvider.AddSetting(IdentitySettingNames.Password.PasswordChangePeriodDays, 2.ToString());
+ TestSettingValueProvider.AddSetting(IdentitySettingNames.Password.ForceUsersToPeriodicallyChangePassword, true.ToString());
+ }
}
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestSettingValueProvider.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestSettingValueProvider.cs
new file mode 100644
index 0000000000..e70abe6e1f
--- /dev/null
+++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestSettingValueProvider.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Settings;
+
+namespace Volo.Abp.Identity;
+
+public class TestSettingValueProvider : ISettingValueProvider, ITransientDependency
+{
+ public const string ProviderName = "Test";
+
+ private readonly static Dictionary Values = new ();
+
+ public string Name => ProviderName;
+
+ public static void AddSetting(string name, string value)
+ {
+ Values[name] = value;
+ }
+
+ public Task GetOrNullAsync(SettingDefinition setting)
+ {
+ return Task.FromResult(Values.GetOrDefault(setting.Name));
+ }
+
+ public Task> GetAllAsync(SettingDefinition[] settings)
+ {
+ return Task.FromResult(settings.Select(x => new SettingValue(x.Name, Values.GetOrDefault(x.Name))).ToList());
+ }
+}
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20230314024329_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20230314024329_Initial.Designer.cs
index de06a29bba..64b3b7ecca 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20230314024329_Initial.Designer.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/20230314024329_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
index cce8de6704..e0b0b2f686 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20230314024404_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20230314024404_Initial.Designer.cs
index 89c2b3b84b..2a5f430902 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20230314024404_Initial.Designer.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/20230314024404_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
index 0d07ceb0d5..6ba91d04bd 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20230314024402_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20230314024402_Initial.Designer.cs
index f9422e71b2..6a16d3f459 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20230314024402_Initial.Designer.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/20230314024402_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs
index 75644093c0..0dc839a24f 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Host.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20230314024433_Initial.Designer.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20230314024433_Initial.Designer.cs
index d1fcdc92c1..e2cab42a1f 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20230314024433_Initial.Designer.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/20230314024433_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs
index 8258783d73..bad5296c0c 100644
--- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Mvc.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20230314023936_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20230314023936_Initial.Designer.cs
index 9534a63418..44019ac4ca 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20230314023936_Initial.Designer.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20230314023936_Initial.Designer.cs
@@ -770,8 +770,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
index 38a4d5d812..db36717434 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs
@@ -767,8 +767,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20230314024642_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20230314024642_Initial.Designer.cs
index bff8c8a221..5d2f29ad1d 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20230314024642_Initial.Designer.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/20230314024642_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs
index f57fe0cc21..db9401d3a9 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations/AuthServerDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20230314024129_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20230314024129_Initial.Designer.cs
index 88343d69c4..26b508fa35 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20230314024129_Initial.Designer.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20230314024129_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs
index 97e369214a..2b067dbd97 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20230314024104_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20230314024104_Initial.Designer.cs
index fcf47b0464..60700e19ff 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20230314024104_Initial.Designer.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20230314024104_Initial.Designer.cs
@@ -717,8 +717,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()
diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
index b3441e6d3e..72be56741e 100644
--- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
+++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
@@ -714,8 +714,8 @@ namespace MyCompanyName.MyProjectName.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
- b.Property("LastPasswordChangeTime")
- .HasColumnType("datetime2");
+ b.Property("LastPasswordChangeTime")
+ .HasColumnType("datetimeoffset");
b.Property("LockoutEnabled")
.ValueGeneratedOnAdd()