mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 15:15:24 +00:00
feat: move totp and passkeys into plugins (C1)
This commit is contained in:
1 parent
f4f26a9b8b
commit
5c18435105
235 files changed
+22545
-5610
No files matched your search
+14
-10
@@ -70,9 +70,6 @@ async function provisionLocalDesktopUserIfNeeded(): Promise<void> {
|
||||
identifierPath: "",
|
||||
namePath: "",
|
||||
scopes: "openid email profile",
|
||||
totpSecret: null,
|
||||
totpEnabled: false,
|
||||
totpBackupCodes: null,
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -203,18 +200,21 @@ async function provisionLocalDesktopUserIfNeeded(): Promise<void> {
|
||||
const {
|
||||
createCurrentSettingsRepository,
|
||||
createCurrentSsoProviderRepository,
|
||||
createCurrentUserAuthRepository,
|
||||
createCurrentUserRepository,
|
||||
} = await import("./database/repositories/factory.js");
|
||||
const [legacyOidc, providers, users] = await Promise.all([
|
||||
createCurrentSettingsRepository().get("oidc_config"),
|
||||
createCurrentSsoProviderRepository().listEnabled(),
|
||||
createCurrentUserRepository().listAll(),
|
||||
]);
|
||||
const [legacyOidc, providers, users, secondFactorUsers] =
|
||||
await Promise.all([
|
||||
createCurrentSettingsRepository().get("oidc_config"),
|
||||
createCurrentSsoProviderRepository().listEnabled(),
|
||||
createCurrentUserRepository().listAll(),
|
||||
createCurrentUserAuthRepository().listUserIdsWithSecondFactors(),
|
||||
]);
|
||||
const conflictingProvider = providers.some((provider) =>
|
||||
["oidc", "github", "google"].includes(provider.type),
|
||||
);
|
||||
const conflictingUser = users.some(
|
||||
(user) => user.isOidc || user.totpEnabled,
|
||||
(user) => user.isOidc || secondFactorUsers.has(user.id),
|
||||
);
|
||||
if (
|
||||
legacyOidc ||
|
||||
@@ -223,7 +223,7 @@ async function provisionLocalDesktopUserIfNeeded(): Promise<void> {
|
||||
conflictingUser
|
||||
) {
|
||||
throw new Error(
|
||||
"Trusted proxy authentication cannot start while OIDC or TOTP is enabled",
|
||||
"Trusted proxy authentication cannot start while OIDC or a second factor is enabled",
|
||||
);
|
||||
}
|
||||
systemLogger.info("Trusted proxy authentication enabled", {
|
||||
@@ -409,6 +409,10 @@ async function provisionLocalDesktopUserIfNeeded(): Promise<void> {
|
||||
const { runSecretSourcesTokenMigration } =
|
||||
await import("./utils/crypto-migration/secret-sources-token-migration.js");
|
||||
await runSecretSourcesTokenMigration();
|
||||
|
||||
const { runTotpMigration } =
|
||||
await import("./utils/crypto-migration/totp-migration.js");
|
||||
await runTotpMigration();
|
||||
} catch (error) {
|
||||
systemLogger.warn("Plugin runtime failed to initialize", {
|
||||
operation: "plugin_init",
|
||||
|
||||
Reference in new issue
Block a user