From 9cfc498e44bc8c6c796a5f01ea7a5e907b5a2ff4 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Tue, 25 Nov 2014 19:15:54 +0800 Subject: [PATCH] fix Password: no extension error --- htdocs/lib/Util/Password.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/htdocs/lib/Util/Password.php b/htdocs/lib/Util/Password.php index 62b11be..0de7320 100644 --- a/htdocs/lib/Util/Password.php +++ b/htdocs/lib/Util/Password.php @@ -134,13 +134,25 @@ class Password { */ public function checkSameTryAll($encrypted, $text) { // 判斷是否吻合 - if($encrypted == $this->encrypt($text) - || $encrypted == $text - || (function_exists('sha1') && $encrypted == $this->sha1Encrypt($text)) - || (function_exists('md5') && $encrypted == $this->md5Encrypt($text)) - || (function_exists('crypt') && $encrypted == $this->cryptEncrypt($text)) - ) return true; - else return false; + if($encrypted == $this->encrypt($text) || + $encrypted == $text) + return true; + else { + if (function_exists('md5')) { + if($encrypted == $this->md5Encrypt($encrypted)) + return true; + } + if (function_exists('sha1')) { + if($encrypted == $this->sha1Encrypt($encrypted)) + return true; + } + if (function_exists('crypt')) { + if($encrypted == $this->cryptEncrypt($encrypted)) + return true; + } + + return false; + } } // ------------------------------------------------------------------------