Updated OSB to work with KH 3.1
This commit is contained in:
@@ -16,26 +16,20 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// If there is a post and $_POST is not empty
|
||||
if ($_POST) {
|
||||
// Instantiate a new user
|
||||
$user = ORM::factory('account');
|
||||
|
||||
// Check Auth
|
||||
$status = $user->login($_POST);
|
||||
|
||||
// If the post data validates using the rules setup in the user model
|
||||
if ($status) {
|
||||
if (Auth::instance()->login($_POST['username'],$_POST['password'])) {
|
||||
// Redirect to the user account
|
||||
if ($redir = Session::instance()->get('afterlogin')) {
|
||||
Session::instance()->delete('afterlogin');
|
||||
Request::instance()->redirect($redir);
|
||||
Request::current()->redirect($redir);
|
||||
|
||||
} else
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
|
||||
} else {
|
||||
SystemMessage::add(array(
|
||||
@@ -53,7 +47,6 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
));
|
||||
|
||||
$this->template->control = HTML::anchor($this->request->uri(),'Login',array('id'=>'ajxbody'));
|
||||
$this->template->content = Block::factory();
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
@@ -66,7 +59,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// Instantiate a new user
|
||||
@@ -112,12 +105,10 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
'title'=>_('Register'),
|
||||
'body'=>View::factory('bregister')
|
||||
->set('account',$account)
|
||||
->set('errors',$account->validate()->errors()),
|
||||
'style'=>array('css/bregister.css'=>'screen'),
|
||||
->set('errors',$account->validation()->errors('form/register')),
|
||||
));
|
||||
|
||||
$this->template->control = HTML::anchor($this->request->uri(),'Register',array('id'=>'ajxbody'));
|
||||
$this->template->content = Block::factory();
|
||||
$this->template->left = HTML::anchor('login','Login').'...';
|
||||
}
|
||||
|
||||
@@ -128,7 +119,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// If the user posted their details to reset their password
|
||||
@@ -172,7 +163,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
|
||||
// Redirect to our password reset, the Auth will validate the token.
|
||||
} elseif (! empty($_REQUEST['token'])) {
|
||||
Request::instance()->redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
|
||||
Request::current()->redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
|
||||
}
|
||||
|
||||
// Show our token screen even if the email was invalid.
|
||||
@@ -183,7 +174,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
else
|
||||
Request::instance()->redirect('login');
|
||||
Request::current()->redirect('login');
|
||||
|
||||
} else {
|
||||
Block::add(array(
|
||||
@@ -192,13 +183,9 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
}
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
public function action_noaccess() {
|
||||
$this->template->content = ' ';
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('No access to requested resource'),
|
||||
'type'=>'error',
|
||||
|
Reference in New Issue
Block a user