Example #1
0
 * Uses the User class and calls Login method with passed params to check authentification validity.
 * If the user passes the authentification he's redirected to the index.php
 * where the CaseBox interface starts loading.
 * Otherwise, if the user do not pass authentification, it is redirected to login.php
 * and the corresponding message is displayed (from $_SESSION['message']).
 *
 * @package CaseBox
 *
 * */
namespace CB;

require_once 'init.php';
if (Oauth2Utils::isOauth2Login()) {
    $Check = Oauth2Utils::checkLogined();
    if ($Check['success']) {
        $r = User::setAsLoged($Check['user_id'], $Check['session_id']);
        if ($r['success'] == false) {
            $errors[] = L\get('Auth_fail');
        } else {
            $cfg = User::getTSVConfig();
            if (!empty($cfg['method'])) {
                $_SESSION['check_TSV'] = time();
                $_SESSION['user']['TSV_checked'] = false;
            } else {
                $_SESSION['user']['TSV_checked'] = true;
            }
        }
        // header('Location: '.Config::get('core_url'));
    } else {
        $errors[] = $Check['message'];
        $_SESSION['message'] = array_shift($errors);