mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 09:14:48 +09:00
Issue 1892 Adding sha1 hash function for password of member.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10565 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4566d43b38
commit
22f700e8ac
3 changed files with 62 additions and 7 deletions
|
|
@ -710,19 +710,56 @@
|
|||
/**
|
||||
* @brief Compare plain text password to the password saved in DB
|
||||
**/
|
||||
function isValidPassword($hashed_password, $password_text) {
|
||||
function isValidPassword($hashed_password, $password_text, $member_srl=null) {
|
||||
// False if no password in entered
|
||||
if(!$password_text) return false;
|
||||
|
||||
$isSha1 = ($useSha1 && function_exists('sha1'));
|
||||
|
||||
// Return true if the user input is equal to md5 hash value
|
||||
if($hashed_password == md5($password_text)) return true;
|
||||
if($hashed_password == md5($password_text)){
|
||||
if($isSha1 && $member_srl > 0)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $member_srl;
|
||||
$args->hashed_password = md5(sha1(md5($password_text)));
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController->updateMemberPassword($args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return true if the user input is equal to the value of mysql_pre4_hash_password
|
||||
if(mysql_pre4_hash_password($password_text) == $hashed_password) return true;
|
||||
if(mysql_pre4_hash_password($password_text) == $hashed_password){
|
||||
if($isSha1 && $member_srl > 0)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $member_srl;
|
||||
$args->hashed_password = md5(sha1(md5($password_text)));
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController->updateMemberPassword($args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Verify the password by using old_password if the current db is MySQL. If correct, return true.
|
||||
if(substr(Context::getDBType(),0,5)=='mysql') {
|
||||
$oDB = &DB::getInstance();
|
||||
if($oDB->isValidOldPassword($password_text, $hashed_password)) return true;
|
||||
if($oDB->isValidOldPassword($password_text, $hashed_password)){
|
||||
if($isSha1 && $member_srl > 0)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->member_srl = $member_srl;
|
||||
$args->hashed_password = md5(sha1(md5($password_text)));
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController->updateMemberPassword($args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if($isSha1 && $hashed_password == md5(sha1(md5($password_text)))) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue