Authorization does not work. Create user:
public function action_create() { $auth = Auth::instance(); $user = ORM::factory('user'); $email = $_POST['email']; $password = $auth->hash_password($_POST['password']); $nickname = $_POST['nickname']; $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; $user->email = $email; $user->password = $password; $user->username = $nickname; $user->birth = $month." ".$day." ".$year; $user->save(); $user = ORM::factory('user'); $role = ORM::factory('roles'); $role->user_id = $user->select('id')->where('email', '=', $email)->find(); $role->role_id = "1"; $role->save(); echo "<div id='create'>Account is created, you can enter now.</div>"; } The user is added to the database, it works. The role to the user is added immediately too.
Authorization:
public function action_login() { if ($_POST){ $username = Arr::get($_POST, 'login', ''); $password = Arr::get($_POST, 'password', ''); $status = Auth::instance()->login($username, $password, TRUE); if($status){ echo 'Ok'; }else{ echo 'Error'; } } I do not know what the problem is. Help me please.
In the module returns
ErrorException [ Notice ]: Undefined index: trane294 MODPATH\auth\classes\kohana\auth\file.php [ 50 ] 43 if (isset($this->_users[$username]) AND $this->_users[$username] === $password) 44 { 45 // Complete the login 46 return $this->complete_login($username); 47 } 48 49 // Login failed 50 return FALSE; 51 } 52 53 /** 54 * Forces a user to be logged in, without specifying a password.