From 3cddce7a976b9d2178dc18339379c7cde8c320ff Mon Sep 17 00:00:00 2001 From: Paul Brown Date: Sun, 10 Mar 2013 22:13:25 -0500 Subject: [PATCH] Update UsersController.php added untested MD5 and SHA support --- app/Controller/UsersController.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php index 06557b3..5096bfd 100644 --- a/app/Controller/UsersController.php +++ b/app/Controller/UsersController.php @@ -97,11 +97,21 @@ protected function _check_password($hash,$pass) { return false; } } elseif ($hash_type == 'sha') { - // TODO: Not yet implimented - return false; + // This has not be tested + $test_hash = '{SHA}' . base64_encode(sha1( $pass, TRUE )); + if (strcmp($hash,$test_hash) == 0) { + return true; + } else { + return false; + } } elseif ($hash_type == 'md5') { - // TODO: Not yet implimented - return false; + // This has not be tested + $test_hash = '{MD5}' . base64_encode(md5( $pass,TRUE)); + if (strcmp($hash,$test_hash) == 0) { + return true; + } else { + return false; + } } else { // Plaintext? if ($pass == $hash) {