]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Check if auth data exists before log in try
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 1 Jan 2016 08:50:38 +0000 (09:50 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Fri, 1 Jan 2016 11:39:18 +0000 (12:39 +0100)
gui/baculum/protected/Class/BaculumUsersManager.php

index cb7a08862d5e03260f52da6cbc799856cb317971..a87ddf3f4536fb866759907ebac3cb2d6ece59f7 100644 (file)
@@ -27,12 +27,10 @@ class BaculumUsersManager extends TModule implements IUserManager {
 
        private $config;
        private $configMod;
-       private $users;
 
        public function init($config) {
                $this->configMod = $this->Application->getModule('configuration');
                $this->config = $this->configMod->isApplicationConfig() ? $this->configMod->getApplicationConfig() : null;
-               $this->users = $this->configMod->getAllUsers();
        }
 
        public function getGuestName() {
@@ -55,7 +53,8 @@ class BaculumUsersManager extends TModule implements IUserManager {
                $user->setID($id);
                $user->setName($username);
                if (!is_null($username)) {
-                       $user->setPwd($this->users[$username]);
+                       $users = $this->configMod->getAllUsers();
+                       $user->setPwd($users[$username]);
                }
                if(is_null($this->config) || $this->config['baculum']['login'] === $username) {
                        $user->setRoles('admin');
@@ -90,7 +89,7 @@ class BaculumUsersManager extends TModule implements IUserManager {
        }
 
        public function loginUser($user = null, $pwd = null) {
-               if (is_null($user) && is_null($pwd)) {
+               if (is_null($user) && is_null($pwd) && isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
                        $user = $_SERVER['PHP_AUTH_USER'];
                        $pwd = $this->Application->getModule('configuration')->getCryptedPassword($_SERVER['PHP_AUTH_PW']);
                }