Forgot to add a way to login
This commit is contained in:
parent
b60af215ed
commit
af865d105b
38
login.php
38
login.php
@ -23,11 +23,40 @@
|
||||
session_save_path('.tmp'); // TEMP
|
||||
session_start(); // START
|
||||
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
|
||||
use App\LobbySIO\Config\Registry;
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (Registry::AUTHMETHOD == 'SAML') {
|
||||
//simplesaml
|
||||
require_once('../simplesamlphp/lib/_autoload.php');
|
||||
$auth = new \SimpleSAML\Auth\Simple(Registry::AUTHIDP);
|
||||
//$auth->requireAuth();
|
||||
$auth->isAuthenticated();
|
||||
if (!$auth->isAuthenticated()) {
|
||||
$attributes = 'none';
|
||||
} else {
|
||||
$attributes = $auth->getAttributes();
|
||||
$saml_user_email = $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'][0];
|
||||
$saml_user_info = $Users->getUserInfoByEmail($saml_user_email, "1", "0");
|
||||
$saml_user_id = $saml_user_info["0"]["users_id"];
|
||||
}
|
||||
$session = \SimpleSAML\Session::getSessionFromRequest();
|
||||
$session->cleanup();
|
||||
}
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); }
|
||||
if (isset($saml_user_id)) {
|
||||
$sessuserid=$saml_user_id;
|
||||
} else {
|
||||
$sessuserid=$_SESSION['user_id'];
|
||||
}
|
||||
} elseif (!isset($_SESSION['user_id'])) {
|
||||
if (isset($saml_user_id)) {
|
||||
$sessuserid=$saml_user_id;
|
||||
} else {
|
||||
$sessuserid=$_SESSION['user_id'];
|
||||
}
|
||||
$session_user = $Users->getUserInfo($sessuserid, "1", "0"); }
|
||||
if (isset($session_user)) { // GET UID OR SET TO KIOSK
|
||||
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
|
||||
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
|
||||
@ -44,9 +73,10 @@
|
||||
$app_current_pagename = $transLang['LOGIN']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
if ($StaticFunctions->getUserSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
} else { ?>
|
||||
} else {
|
||||
$auth->requireAuth();?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
<?php
|
||||
|
Loading…
Reference in New Issue
Block a user