diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-02-03 11:56:01 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-02-03 11:56:01 +0100 |
commit | f85bfdf186c525056e7c30e6b072b1bea9ba80c9 (patch) | |
tree | 1c49680b4256f87889af267cb2d761ae71e8971b /inc/poche/Poche.class.php | |
parent | cae70cdbdb518b6effe212528c894a390256cf2d (diff) | |
parent | 6af66b1106e67a8dc467a70e8e57d7963b09936b (diff) | |
download | wallabag-f85bfdf186c525056e7c30e6b072b1bea9ba80c9.tar.gz wallabag-f85bfdf186c525056e7c30e6b072b1bea9ba80c9.tar.zst wallabag-f85bfdf186c525056e7c30e6b072b1bea9ba80c9.zip |
Merge branch 'dev' of git://github.com/mariroz/wallabag into mariroz-dev
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r-- | inc/poche/Poche.class.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e9b14121..77361ef7 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -692,17 +692,17 @@ class Poche | |||
692 | */ | 692 | */ |
693 | private function credentials() { | 693 | private function credentials() { |
694 | if(isset($_SERVER['PHP_AUTH_USER'])) { | 694 | if(isset($_SERVER['PHP_AUTH_USER'])) { |
695 | return array($_SERVER['PHP_AUTH_USER'],'php_auth'); | 695 | return array($_SERVER['PHP_AUTH_USER'],'php_auth',true); |
696 | } | 696 | } |
697 | if(!empty($_POST['login']) && !empty($_POST['password'])) { | 697 | if(!empty($_POST['login']) && !empty($_POST['password'])) { |
698 | return array($_POST['login'],$_POST['password']); | 698 | return array($_POST['login'],$_POST['password'],false); |
699 | } | 699 | } |
700 | if(isset($_SERVER['REMOTE_USER'])) { | 700 | if(isset($_SERVER['REMOTE_USER'])) { |
701 | return array($_SERVER['REMOTE_USER'],'http_auth'); | 701 | return array($_SERVER['REMOTE_USER'],'http_auth',true); |
702 | } | 702 | } |
703 | 703 | ||
704 | return array(false,false); | 704 | return array(false,false,false); |
705 | } | 705 | } |
706 | 706 | ||
707 | /** | 707 | /** |
708 | * checks if login & password are correct and save the user in session. | 708 | * checks if login & password are correct and save the user in session. |
@@ -713,18 +713,19 @@ class Poche | |||
713 | */ | 713 | */ |
714 | public function login($referer) | 714 | public function login($referer) |
715 | { | 715 | { |
716 | list($login,$password)=$this->credentials(); | 716 | list($login,$password,$isauthenticated)=$this->credentials(); |
717 | if($login === false || $password === false) { | 717 | if($login === false || $password === false) { |
718 | $this->messages->add('e', _('login failed: you have to fill all fields')); | 718 | $this->messages->add('e', _('login failed: you have to fill all fields')); |
719 | Tools::logm('login failed'); | 719 | Tools::logm('login failed'); |
720 | Tools::redirect(); | 720 | Tools::redirect(); |
721 | } | 721 | } |
722 | if (!empty($login) && !empty($password)) { | 722 | if (!empty($login) && !empty($password)) { |
723 | $user = $this->store->login($login, Tools::encodeString($password . $login)); | 723 | $user = $this->store->login($login, Tools::encodeString($password . $login), $isauthenticated); |
724 | if ($user != array()) { | 724 | if ($user != array()) { |
725 | # Save login into Session | 725 | # Save login into Session |
726 | $longlastingsession = isset($_POST['longlastingsession']); | 726 | $longlastingsession = isset($_POST['longlastingsession']); |
727 | Session::login($user['username'], $user['password'], $login, Tools::encodeString($password . $login), $longlastingsession, array('poche_user' => new User($user))); | 727 | $passwordTest = ($isauthenticated) ? $user['password'] : Tools::encodeString($password . $login); |
728 | Session::login($user['username'], $user['password'], $login, $passwordTest, $longlastingsession, array('poche_user' => new User($user))); | ||
728 | $this->messages->add('s', _('welcome to your poche')); | 729 | $this->messages->add('s', _('welcome to your poche')); |
729 | Tools::logm('login successful'); | 730 | Tools::logm('login successful'); |
730 | Tools::redirect($referer); | 731 | Tools::redirect($referer); |