From 555b3ebbeb6a8da7c0b1ef69e1c083cdc83349d0 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Tue, 25 Nov 2014 19:03:37 +0800 Subject: [PATCH] fix Password: no extension error --- htdocs/lib/Util/Password.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/lib/Util/Password.php b/htdocs/lib/Util/Password.php index afa1b82..62b11be 100644 --- a/htdocs/lib/Util/Password.php +++ b/htdocs/lib/Util/Password.php @@ -134,16 +134,13 @@ class Password { */ public function checkSameTryAll($encrypted, $text) { // 判斷是否吻合 - switch($encrypted) { - case $this->encrypt($text): - case $text: - case $this->sha1Encrypt($text): - case $this->md5Encrypt($text): - case $this->cryptEncrypt($text): - return true; - default: - return false; - } + 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; } // ------------------------------------------------------------------------