From: Marcin Haba Date: Wed, 3 Oct 2018 18:23:29 +0000 (+0200) Subject: baculum: Fix basic auth user setting in API install wizard X-Git-Tag: Release-9.2.2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f4202827ce1f6a0b132a368af5fe120054ce675;p=thirdparty%2Fbacula.git baculum: Fix basic auth user setting in API install wizard --- diff --git a/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php b/gui/baculum/protected/API/Pages/Panel/APIInstallWizard.php index a968a70e3..f1cd2947b 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;