This repository has been archived on 2019-04-06. You can view files and clone it, but cannot push or open issues or pull requests.
onemove/application/classes/controller/login.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 = "Неверный логин или пароль.";
}
}
}