Fixed LDAP authentication + unified app config options: authenticate_settings, security and ldap

This commit is contained in:
Dmitry Khomutov 2017-01-22 18:05:24 +07:00
commit f3bdeb2493
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
17 changed files with 105 additions and 245 deletions

View file

@ -42,8 +42,9 @@ class SessionController extends Controller
public function init()
{
$this->response->disableLayout();
$this->userStore = b8\Store\Factory::getStore('User');
$this->authentication = Service::getInstance();
$this->userStore = b8\Store\Factory::getStore('User');
$this->authentication = Service::getInstance();
}
/**
@ -60,8 +61,8 @@ class SessionController extends Controller
} else {
unset($_SESSION['login_token']);
$email = $this->getParam('email');
$password = $this->getParam('password', '');
$email = $this->getParam('email');
$password = $this->getParam('password', '');
$isLoginFailure = true;
$user = $this->userStore->getByEmailOrName($email);

View file

@ -47,6 +47,7 @@ class SettingsController extends Controller
/**
* Display settings forms.
*
* @return string
*/
public function index()
@ -72,18 +73,18 @@ class SettingsController extends Controller
$emailSettings = $this->settings['php-censor']['email_settings'];
}
$authSettings = [];
if (isset($this->settings['php-censor']['authentication_settings'])) {
$authSettings = $this->settings['php-censor']['authentication_settings'];
$securitySettings = [];
if (isset($this->settings['php-censor']['security'])) {
$securitySettings = $this->settings['php-censor']['security'];
}
$this->view->configFile = APP_DIR . 'config.yml';
$this->view->basicSettings = $this->getBasicForm($basicSettings);
$this->view->buildSettings = $this->getBuildForm($buildSettings);
$this->view->github = $this->getGithubForm();
$this->view->emailSettings = $this->getEmailForm($emailSettings);
$this->view->authenticationSettings = $this->getAuthenticationForm($authSettings);
$this->view->isWriteable = $this->canWriteConfig();
$this->view->configFile = APP_DIR . 'config.yml';
$this->view->basicSettings = $this->getBasicForm($basicSettings);
$this->view->buildSettings = $this->getBuildForm($buildSettings);
$this->view->github = $this->getGithubForm();
$this->view->emailSettings = $this->getEmailForm($emailSettings);
$this->view->securitySettings = $this->getAuthenticationForm($securitySettings);
$this->view->isWriteable = $this->canWriteConfig();
if (!empty($this->settings['php-censor']['github']['token'])) {
$this->view->githubUser = $this->getGithubUser($this->settings['php-censor']['github']['token']);
@ -187,8 +188,8 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['php-censor']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0);
$this->settings['php-censor']['authentication_settings']['user_id'] = $_SESSION['php-censor-user-id'];
$this->settings['php-censor']['security']['disable_auth'] = (boolean)$this->getParam('disable_authentication', false);
$this->settings['php-censor']['security']['default_user_id'] = (integer)$_SESSION['php-censor-user-id'];
$error = $this->storeSettings();
@ -479,8 +480,8 @@ class SettingsController extends Controller
$field->setContainerClass('form-group');
$field->setValue(0);
if (isset($values['state'])) {
$field->setValue((int)$values['state']);
if (isset($values['disable_auth'])) {
$field->setValue((integer)$values['disable_auth']);
}
$form->addField($field);