Skip to content

Instantly share code, notes, and snippets.

@RyujiAMANO
Created February 20, 2018 08:02
Show Gist options
  • Save RyujiAMANO/28cb8f527df8a2e7abd4aefe26e3b46c to your computer and use it in GitHub Desktop.
Save RyujiAMANO/28cb8f527df8a2e7abd4aefe26e3b46c to your computer and use it in GitHub Desktop.
XOOPS Cube Legacy2.2でパスワードをsha1で保存するpreload
<?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