From c468d0f064dedf3e0609adcb120447f1cabefb0b Mon Sep 17 00:00:00 2001 From: Leandro Menezes Date: Thu, 19 Dec 2024 13:59:25 -0300 Subject: [PATCH] changed error codes based on code rabbit review --- src/scripts/disable-openid.js | 8 ++++---- src/scripts/enable-openid.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/scripts/disable-openid.js b/src/scripts/disable-openid.js index 5c21ba76e..b736b3999 100644 --- a/src/scripts/disable-openid.js +++ b/src/scripts/disable-openid.js @@ -6,7 +6,7 @@ import { import { promptPassword } from '../util/prompt.js'; if (needsBootstrap()) { - console.log('System needs to be bootstrapped first. Please set up the server before managing OpenID.'); + console.log('System needs to be bootstrapped first. OpenID is not enabled.'); process.exit(1); } else { @@ -17,7 +17,7 @@ if (needsBootstrap()) { if (loginMethod === 'password') { console.log('OpenID already disabled.'); - process.exit(1); + process.exit(0); } const password = await promptPassword(); @@ -28,7 +28,7 @@ if (needsBootstrap()) { console.log( 'Please report this as an issue: https://github.com/actualbudget/actual-server/issues', ); - process.exit(1); + process.exit(2); } console.log('OpenID disabled!'); console.log( @@ -39,6 +39,6 @@ if (needsBootstrap()) { console.log( 'Please report this as an issue: https://github.com/actualbudget/actual-server/issues', ); - process.exit(1); + process.exit(2); } } diff --git a/src/scripts/enable-openid.js b/src/scripts/enable-openid.js index 132b1761d..8007d9cdb 100644 --- a/src/scripts/enable-openid.js +++ b/src/scripts/enable-openid.js @@ -10,7 +10,7 @@ if (needsBootstrap()) { '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); + process.exit(1); } else { console.log('Enabling openid based on Environment variables or config.json'); try { @@ -19,7 +19,7 @@ if (needsBootstrap()) { if (loginMethod === 'openid') { console.log('OpenID already enabled.'); - process.exit(1); + process.exit(0); } const { error } = (await enableOpenID(finalConfig)) || {}; @@ -28,7 +28,7 @@ if (needsBootstrap()) { console.log( 'Please report this as an issue: https://github.com/actualbudget/actual-server/issues', ); - process.exit(1); + process.exit(2); } console.log('OpenID enabled!'); console.log( @@ -39,6 +39,6 @@ if (needsBootstrap()) { console.log( 'Please report this as an issue: https://github.com/actualbudget/actual-server/issues', ); - process.exit(1); + process.exit(2); } }