Kohana 3: Auth module
- by Thomas
Hi, i'm trying to learn the Kohana's Auth module but login method always return false.
Controller:
<?php defined('SYSPATH') OR die('No Direct Script Access');
class Controller_Auth extends Controller {
public function action_index() {
if($_POST) {
$this->login();
}
$this->template = View::factory('login');
echo $this->template;
}
private function login() {
$user = ORM::factory('user');
$data = array('username' => 'wilson', 'password' => '123');
if(!$user->login($data)) {
echo 'FAILED!';
}
}
private function logout() {
}
}
?>
Model:
<?php defined('SYSPATH') or die('No direct script access.');
class Model_User extends Model_Auth_User {
}
?>