]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/security/SessionManager.php
Add ldap connection
[github/shaarli/Shaarli.git] / application / security / SessionManager.php
index 24e255283731aedb951d8624a7b2ec7dfc120136..5eb4aac55d4be4b0681e96470269f85ee09dffaf 100644 (file)
@@ -111,10 +111,10 @@ class SessionManager
      *
      * @param string $clientIpId Client IP address identifier
      */
-    public function storeLoginInfo($clientIpId)
+    public function storeLoginInfo($clientIpId, $login = null)
     {
         $this->session['ip'] = $clientIpId;
-        $this->session['username'] = $this->conf->get('credentials.login');
+        $this->session['username'] = $login ?: $this->conf->get('credentials.login');
         $this->extendTimeValidityBy(self::$SHORT_TIMEOUT);
     }
 
@@ -169,6 +169,9 @@ class SessionManager
      */
     public function hasSessionExpired()
     {
+        if (empty($this->session['expires_on'])) {
+            return true;
+        }
         if (time() >= $this->session['expires_on']) {
             return true;
         }
@@ -188,7 +191,7 @@ class SessionManager
         if ($this->conf->get('security.session_protection_disabled') === true) {
             return false;
         }
-        if ($this->session['ip'] == $clientIpId) {
+        if (isset($this->session['ip']) && $this->session['ip'] === $clientIpId) {
             return false;
         }
         return true;