Created
February 20, 2018 08:02
-
-
Save RyujiAMANO/28cb8f527df8a2e7abd4aefe26e3b46c to your computer and use it in GitHub Desktop.
XOOPS Cube Legacy2.2でパスワードをsha1で保存するpreload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// そのままでは動きません | |
if (!defined('XOOPS_ROOT_PATH')) { | |
exit(); | |
} | |
class EncryptSha1Password extends XCube_ActionFilter | |
{ | |
public function preFilter() | |
{ | |
//登録されてる暗号化デリゲート先をリセットする。 | |
$this->mController->mRoot->mDelegateManager->reset("User.EncryptPassword"); | |
$this->mController->mRoot->mDelegateManager->reset("User.getEncryptPasswordLength"); | |
$this->mController->mRoot->mDelegateManager->add("User.EncryptPassword", array(&$this, "encryptPassword")); | |
$this->mController->mRoot->mDelegateManager->add("User.GetEncryptPasswordLength", array(&$this, "getEncryptPasswordLength")); | |
} | |
public function encryptPassword(&$password) | |
{ | |
$password = sha1($password); | |
} | |
public function getEncryptPasswordLength() | |
{ | |
// sha1 length | |
return 40; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment