Reputation: 1
I'm having two issue with Kohana Auth module:
What I have done so far:
Hopes anyone can help me on this...really a critical request..
Some of my reference:
Regards, Nas
Upvotes: 0
Views: 592
Reputation: 282
Maybe this will help: Register action:
$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);
}
Login action:
$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');
}
Upvotes: 0