1

我们正在开发一个管理用户的软件,我需要使用 Kohana 3 和 Auth Module 构建一个应用程序。我的应用程序将只允许登录。用户登录时,我不需要在密码中添加盐。我该怎么做?谢谢你。

编辑:

我知道,它错了,但我改变了核心。现在我加密没有盐的密码:/kohana/modules/auth/classes/model/auth/user.php

public function login($username, $password, $remember = FALSE)
{
    if (empty($password))
        return FALSE;

    if (is_string($password))
    {
        // Get the salt from the stored password
        //$salt = $this->find_salt($this->password($username));
        // Create a hashed password using the salt from the stored password
        //$password = $this->hash_password($password, $salt);
        $password = sha1($password);
    }

    return $this->_login($username, $password, $remember);
}
4

1 回答 1

1

当然你需要这样做。否则,您会将密码存储为纯文本。您没有指定是使用文件还是 orm 系统。无论如何,没有理由这样做,因为从登录逻辑中破解salat功能更加困难,然后就按原样使用它。

于 2010-06-14T19:55:18.507 回答