- improved ajax authentication check and "logout" notification | closed #198 - improved logging, added missing log file configuration to pathfinder.ini - added logging for "unauthorized" requests | closed #198 - updated js "jQuery" 1.11.3 -> 3.0.0 | #206 - updated js "datatables" plugin 1.10.7 -> 1.10.12 | #206 - updated js "mCustomScrollbar" 3.1.14 -> 3.1.4 | #206
43 lines
910 B
PHP
43 lines
910 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: exodus4d
|
|
* Date: 09.02.15
|
|
* Time: 23:30
|
|
*/
|
|
|
|
namespace Controller;
|
|
use Controller\Api as Api;
|
|
use Model;
|
|
|
|
class AccessController extends Controller {
|
|
|
|
/**
|
|
* event handler
|
|
* @param \Base $f3
|
|
*/
|
|
function beforeroute(\Base $f3) {
|
|
parent::beforeroute($f3);
|
|
|
|
// Any route/endpoint of a child class of this one,
|
|
// requires a valid logged in user!
|
|
$loginCheck = $this->checkLogTimer($f3);
|
|
|
|
if( !$loginCheck ){
|
|
// no user found or login timer expired
|
|
$this->logout($f3);
|
|
|
|
if( $f3->get('AJAX') ){
|
|
// unauthorized request
|
|
$f3->status(403);
|
|
}else{
|
|
// redirect to landing page
|
|
$f3->reroute('@login');
|
|
}
|
|
|
|
// die() triggers unload() function
|
|
die();
|
|
}
|
|
}
|
|
|
|
} |