21 lines
785 B
PHP
21 lines
785 B
PHP
<?php defined('SYSPATH') or die('No direct script access.');
|
|
|
|
class Controller_Login extends Controller_Template {
|
|
public $template = 'login';
|
|
public function action_view() {
|
|
if(Auth::instance()->logged_in()){
|
|
if (Auth::instance()->logged_in(array('admin')) === FALSE) return $this->request->redirect('events/view');
|
|
return $this->request->redirect('overview/view');
|
|
}
|
|
if ($_POST){
|
|
$user = ORM::factory('user');
|
|
$status = Auth::instance()->login($_POST['login'], $_POST['password']);
|
|
if ($status){
|
|
if (Auth::instance()->logged_in(array('admin')) === FALSE) return $this->request->redirect('events/view');
|
|
return $this->request->redirect('overview/view');
|
|
}
|
|
else $this->template->error = "Неверный логин или пароль.";
|
|
}
|
|
}
|
|
}
|