Files
Heimdall/src/Heimdall.Infrastructure/Data/Configurations/IdentityConfiguration.cs
T
Arnaud Dartois 7a71a09102 fix(api): replace lockout with MustChangePassword flag in ResetPasswordAsync
Setting LockoutEnd to UtcNow locked the user out instead of forcing
a password change. Added MustChangePassword boolean to AppUser entity
with EF Core migration. ResetPasswordAsync now sets this flag instead
of locking the account.
2026-07-17 19:21:12 +00:00

81 lines
2.2 KiB
C#

using Heimdall.Domain.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Heimdall.Infrastructure.Data.Configurations;
public class AppUserConfiguration : IEntityTypeConfiguration<AppUser>
{
public void Configure(EntityTypeBuilder<AppUser> builder)
{
builder.ToTable("users");
builder.Property(u => u.DisplayName)
.HasMaxLength(200)
.IsRequired();
builder.Property(u => u.Theme)
.HasMaxLength(20)
.HasDefaultValue("Auto");
builder.Property(u => u.Language)
.HasMaxLength(10)
.HasDefaultValue("fr");
builder.Property(u => u.CreatedAt)
.HasDefaultValueSql("NOW()");
builder.Property(u => u.MustChangePassword)
.HasDefaultValue(false);
}
}
public class AppRoleConfiguration : IEntityTypeConfiguration<AppRole>
{
public void Configure(EntityTypeBuilder<AppRole> builder)
{
builder.ToTable("roles");
}
}
public class IdentityUserRoleConfiguration : IEntityTypeConfiguration<IdentityUserRole<Guid>>
{
public void Configure(EntityTypeBuilder<IdentityUserRole<Guid>> builder)
{
builder.ToTable("user_roles");
}
}
public class IdentityUserClaimConfiguration : IEntityTypeConfiguration<IdentityUserClaim<Guid>>
{
public void Configure(EntityTypeBuilder<IdentityUserClaim<Guid>> builder)
{
builder.ToTable("user_claims");
}
}
public class IdentityUserLoginConfiguration : IEntityTypeConfiguration<IdentityUserLogin<Guid>>
{
public void Configure(EntityTypeBuilder<IdentityUserLogin<Guid>> builder)
{
builder.ToTable("user_logins");
}
}
public class IdentityRoleClaimConfiguration : IEntityTypeConfiguration<IdentityRoleClaim<Guid>>
{
public void Configure(EntityTypeBuilder<IdentityRoleClaim<Guid>> builder)
{
builder.ToTable("role_claims");
}
}
public class IdentityUserTokenConfiguration : IEntityTypeConfiguration<IdentityUserToken<Guid>>
{
public void Configure(EntityTypeBuilder<IdentityUserToken<Guid>> builder)
{
builder.ToTable("user_tokens");
}
}