Kohana 3.3:Auth Module - 能够使用虚假密码登录

时间:2013-07-02 03:10:10

标签: kohana kohana-auth

我在Kohana Auth模块中遇到两个问题:

  1. 能够使用虚假密码登录
  2. 我已从应用程序注销,但在浏览器中单击“返回”按钮时,它会显示安全端的内容。然后我刷新该页面,它重定向到登录页面 - 当用户点击浏览器中的后退按钮时,我需要这个重定向。
  3. 到目前为止我做了什么:

    1. 我创建了一个解决方法来手动检查密码相等而不是使用内置登录方法,如果成功,请使用Kohana Auth预定义方法。
    2. 我已经使用Firebug检查了Session值,当我注销时它正在改变。假设点击“后退”按钮不会显示安全端,因为我在页面上有ACL工具。
    3. 希望任何人都可以帮助我......真的是一个关键的要求..

      我的一些参考资料:

      1. Cannot login with Kohana 3.3.0 ORM Auth
      2. http://forum.kohanaframework.org/discussion/comment/78699#Comment_78699
      3. http://forum.kohanaframework.org/discussion/11756/kohana-auth-module-3-3/p1
      4. 此致 NAS

1 个答案:

答案 0 :(得分:0)

也许这会有所帮助: 注册行动:

$extra_rules = Validation::factory($this->request->post())
                        ->rule('password', 'not_empty')
                        ->rule('password', 'min_length', array(':value', '8'))
                        ->rule('password_confirm', 'matches', array(':validation', 'password_confirm', 'password'))

                $user->create($extra_rules);
//if You want to enable login add a role, or You can put it later on account confirmation or something
                if ($user->saved()) {
                    $user->add('roles', 1);
                }

登录操作:

$logged = Auth::instance()->login($this->request->post('username'), $this->request->post('password'), $_POST['autologin'] = true);

        if ($logged == true) {
            $user = Auth::instance()->get_user();
            $userId = $user->id;

            HTTP::redirect('somewhere');
        } else {
            $validation = Validation::factory($this->request->post())
                    ->rule('username', 'not_empty')
                    ->rule('password', 'not_empty');
            if ($validation->check()) {
                $validation->error('username', 'general');
            }
相关问题