feat(auth): replace TOTP with phone-first login

This commit is contained in:
2026-07-28 17:39:29 +08:00
parent e7d350ec3d
commit c7f9a4e3c9
43 changed files with 18386 additions and 882 deletions

View File

@@ -92,8 +92,7 @@ public static class DevelopmentPlatformAdminSeeder
Name = "Local Platform Administrator",
EmailConfirmed = true,
Status = UserStatus.Active,
ForcePasswordChange = true,
TwoFactorEnabled = false
ForcePasswordChange = true
};
var passwordHasher = new PasswordHasher<User>(Options.Create(new PasswordHasherOptions
{
@@ -145,7 +144,6 @@ public static class DevelopmentPlatformAdminSeeder
user.Email,
RoleCode,
ForcePasswordChange = true,
MfaEnrollmentRequired = true,
Source = "ef_core_use_seeding"
})
});
@@ -187,6 +185,6 @@ public static class DevelopmentPlatformAdminSeeder
Console.WriteLine("Development platform administrator created by EF Core data seeding.");
Console.WriteLine($" Account: {Email}");
Console.WriteLine($" Temporary password: {temporaryPassword}");
Console.WriteLine(" Change the password and enroll TOTP MFA at first sign-in. This password is shown only once.");
Console.WriteLine(" Change the temporary password at first sign-in. This password is shown only once.");
}
}

View File

@@ -78,8 +78,7 @@ public sealed class PlatformAdminBootstrapper(
Name = string.IsNullOrWhiteSpace(options.DisplayName) ? "Platform Administrator" : options.DisplayName.Trim(),
EmailConfirmed = true,
Status = UserStatus.Active,
ForcePasswordChange = true,
TwoFactorEnabled = false
ForcePasswordChange = true
};
var createResult = await userManager.CreateAsync(user, options.TemporaryPassword);
if (!createResult.Succeeded)
@@ -140,7 +139,7 @@ public sealed class PlatformAdminBootstrapper(
user.Email,
RoleCode = SuperAdminRoleCode,
ForcePasswordChange = true,
MfaEnrollmentRequired = true
LoginMethod = "account_password"
})
});