Fix password reset issues

This commit is contained in:
Deon George
2013-04-18 18:17:33 +10:00
parent 6cb3e55ca9
commit 13982be9f6
14 changed files with 99 additions and 69 deletions

View File

@@ -15,17 +15,11 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
public function action_index() {
// If user already signed-in
if (Auth::instance()->logged_in() != 0) {
// Redirect to the user account
if (Auth::instance()->logged_in())
HTTP::redirect(URL::link('user','welcome/index'));
}
// If there is a post and $_POST is not empty
if ($_POST) {
// Store our details in a session key
Session::instance()->set(Kohana::$config->load('auth')->session_key,$_POST['username']);
Session::instance()->set('password',$_POST['password']);
// If the post data validates using the rules setup in the user model
if (Auth::instance()->login($_POST['username'],$_POST['password'])) {
// Redirect to the user account
@@ -37,10 +31,6 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
HTTP::redirect(URL::link('user','welcome/index'));
} else {
// We are not successful logging in, so delete our session data
Session::instance()->delete(Kohana::$config->load('auth')->session_key);
Session::instance()->delete('password');
SystemMessage::add(array(
'title'=>_('Invalid username or password'),
'type'=>'error',

View File

@@ -15,8 +15,11 @@ class lnApp_Controller_Logout extends Controller {
# If user already signed-in
if (Auth::instance()->logged_in()!= 0) {
$ao = Auth::instance()->get_user();
Auth::instance()->logout();
$ao->log('Logged Out');
if (method_exists($ao,'log'))
$ao->log('Logged Out');
Auth::instance()->logout(TRUE);
HTTP::redirect('login');
}

View File

@@ -56,7 +56,7 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
(is_array($this->secure_actions) && array_key_exists($this->request->action(),$this->secure_actions) &&
Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__) === FALSE));
is_null(Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__))));
}
/**