From c19b68a0c8d70455923f194fd5fc6ff752a418f1 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Wed, 3 Oct 2018 20:23:29 +0200 Subject: [PATCH] baculum: Fix basic auth user setting in API install wizard --- .../protected/API/Pages/Panel/APIInstallWizard.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php b/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php index a968a70e39..f1cd2947b7 100644 --- a/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php +++ b/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php @@ -203,8 +203,9 @@ class APIInstallWizard extends BaculumAPIPage { $cfg_data['jsontools']['bcons_cfg_path'] = $this->BconsCfgPath->Text; $ret = $this->getModule('api_config')->setConfig($cfg_data); - if ($ret && ($this->first_run || $this->add_auth_params)) { - if ($this->AuthBasic->Checked && $this->getModule('basic_apiuser')->isUsersConfig()) { + if ($ret) { + if ($this->first_run && $this->AuthBasic->Checked && $this->getModule('basic_apiuser')->isUsersConfig()) { + // save basic auth user only on first run $this->getModule('basic_apiuser')->setUsersConfig( $this->APILogin->Text, $this->APIPassword->Text, @@ -216,7 +217,8 @@ class APIInstallWizard extends BaculumAPIPage { $this->switchToUser($this->APILogin->Text, $this->APIPassword->Text); // here is exit } - if ($this->AuthOAuth2->Checked) { + if (($this->first_run || $this->add_auth_params) && $this->AuthOAuth2->Checked) { + // save OAuth2 auth user on first run or when no OAuth2 client defined $oauth2_cfg = $this->getModule('oauth2_config')->getConfig(); $oauth2_cfg[$this->APIOAuth2ClientId->Text] = array(); $oauth2_cfg[$this->APIOAuth2ClientId->Text]['client_id'] = $this->APIOAuth2ClientId->Text; -- 2.47.3