Themeing work based on bootstrap
This commit is contained in:
@@ -14,18 +14,14 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
|
||||
protected $auth_required = FALSE;
|
||||
|
||||
public function action_index() {
|
||||
$output = '';
|
||||
|
||||
// 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,37 +33,28 @@ 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',
|
||||
'body'=>_('The username or password was invalid.')
|
||||
));
|
||||
SystemMessage::factory()
|
||||
->title(_('Invalid username or password'))
|
||||
->type('error')
|
||||
->body(_('The username or password was invalid.'));
|
||||
}
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Login to server'),
|
||||
'body'=>View::factory('login'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
$output .= View::factory('pages/login');
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
$("#ajxbody").click(function() {$("#ajBODY").load("'.$this->request->uri().'/"); return false;});
|
||||
});'
|
||||
));
|
||||
Style::factory()
|
||||
->type('file')
|
||||
->data('media/theme/baseadmin/css/pages/login.css');
|
||||
|
||||
$this->template->content = $output;
|
||||
$this->template->shownavbar = FALSE;
|
||||
}
|
||||
|
||||
public function action_noaccess() {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('No access to requested resource'),
|
||||
'type'=>'error',
|
||||
'body'=>_('You do not have access to the requested resource, please contact your administrator.')
|
||||
));
|
||||
SystemMessage::factory()
|
||||
->title(_('No access to requested resource'))
|
||||
->type('error')
|
||||
->body(_('You do not have access to the requested resource, please contact your administrator.'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user