From 967c66b40a61224e015784a7ab3f5c1f2ca50949 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 23 Jan 2015 21:00:27 +0100 Subject: [PATCH] Auto login after installation --- php/modules/Session.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/php/modules/Session.php b/php/modules/Session.php index 70054d0..0f3f9b1 100755 --- a/php/modules/Session.php +++ b/php/modules/Session.php @@ -44,9 +44,13 @@ class Session extends Module { # Path to Lychee for the server-import dialog $return['config']['location'] = LYCHEE; - # No login - if ($this->settings['username']===''&&$this->settings['password']==='') $return['config']['login'] = false; - else $return['config']['login'] = true; + # Check if login credentials exist and login if they don't + if ($this->noLogin()===true) { + $public = false; + $return['config']['login'] = false; + } else { + $return['config']['login'] = true; + } if ($public===false) { @@ -109,6 +113,21 @@ class Session extends Module { } + private function noLogin() { + + # Check dependencies + self::dependencies(isset($this->settings)); + + # Check if login credentials exist and login if they don't + if ($this->settings['username']===''&&$this->settings['password']==='') { + $_SESSION['login'] = true; + return true; + } + + return false; + + } + public function logout() { # Call plugins