Files
actual/packages/sync-server/src/scripts/enable-openid.js
T
65b154151f [AI] Enable subpath imports across all packages (#7462)
* [AI] Enable subpath imports across all packages

Generalize the prefer-subpath-imports ESLint rule to work with any
package (not just loot-core) and enable it globally. Add subpath import
mappings to cli, component-library, and sync-server package.json files.
Auto-fix all backtracked relative imports to use #-prefixed subpath
imports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [AI] Add release notes for #7462

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [AI] Fix mock specifiers in accounts.test.ts to use aliased imports

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

* [AI] Fix mock specifiers in query.test.ts to use aliased imports

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

* [AI] Fix ESLint rule to properly validate src/ directory paths

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

* [AI] Add publishConfig.imports for sync-server to remap aliases to build directory

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
2026-04-11 08:56:49 +00:00

54 lines
1.6 KiB
JavaScript

import {
enableOpenID,
getActiveLoginMethod,
needsBootstrap,
} from '#account-db';
import { config } from '#load-config';
if (needsBootstrap()) {
console.log(
"It looks like you don't have a password set yet. Password is the fallback authentication method when using OpenID. Execute the command reset-password before using this command!",
);
process.exit(1);
} else {
console.log('Enabling openid based on Environment variables or config.json');
try {
const loginMethod = getActiveLoginMethod();
console.log(`Current login method: ${loginMethod}`);
if (loginMethod === 'openid') {
console.log('OpenID already enabled.');
process.exit(0);
}
const { error } = (await enableOpenID(config.getProperties())) || {};
if (error) {
console.log('Error enabling openid:', error);
if (error === 'invalid-login-settings') {
console.log(
'Error configuring OpenID. Please verify that the configuration file or environment variables are correct.',
);
process.exit(1);
} else {
console.log(
'Please report this as an issue: https://github.com/actualbudget/actual-server/issues',
);
process.exit(2);
}
}
console.log('OpenID enabled!');
console.log(
'Note: The first user to login with OpenID will be the owner of the server.',
);
} catch (err) {
console.log('Unexpected error:', err);
console.log(
'Please report this as an issue: https://github.com/actualbudget/actual-server/issues',
);
process.exit(2);
}
}