R
R
Recew2015-03-11 17:00:58
ORM
Recew, 2015-03-11 17:00:58

Kohana 3.3. Auth does not authorize administrators, only users. Why?

Authorization of users with login rights is normal, but when trying to log in as a user with admin rights, no_user error "Does not exist login / password".
I found similar problems on the Internet, but they arose due to the fact that the wrong driver was specified in the configuration. I'm fine with the configuration, like:

<?php defined('SYSPATH') OR die('No direct access allowed.');

return array(

  'driver'       => 'ORM',
  'hash_method'  => 'sha256',
  'hash_key'     => '54l',
  'lifetime'     => 1209600,
  'session_type' => Session::$default,
  'session_key'  => 'auth_user',

  // Username/password combinations for the Auth File driver
  'users' => array(
    // 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02',
  ),

);

I took the tables for ORM from the modules\orm folder, as expected.
Authorization action:
public function action_login() {

        if (isset($_POST['submit'])){
            $data = Arr::extract($_POST, array('username', 'password', 'remember'));
            $status = Auth::instance()->login($data['username'], $data['password'], (bool) $data['remember']);

            if ($status){
                HTTP::redirect($settings->site_url, 302 );
            }
            else {
                $errors = array(Kohana::message('auth/user', 'no_user'));
            }
        }

        $this->template->content = View::factory('widgets/v_authorize')
            ->bind('errors', $errors);

    }

Help deal with this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inververs, 2015-03-13
@Recew

The admin must have 2 roles. admin and login
See what you have in the roles_users table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question