saml enable - initial testing
This commit is contained in:
43
profile.php
43
profile.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,7 +73,7 @@
|
||||
$app_current_pagename = $transLang['ACCOUNT']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
if ($StaticFunctions->getUserSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
@@ -90,12 +119,13 @@
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="firstname" class="col-sm-2 col-form-label"><?php echo $transLang['FIRSTNAME']; ?></label>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="firstname" id="firstname" maxlength="50" value="<?php echo $session_user["0"]["users_firstname"]; ?>" /></div>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="firstname" id="firstname" maxlength="50" value="<?php echo $session_user["0"]["users_firstname"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } ?>/></div>
|
||||
<label for="lastname" class="col-sm-2 col-form-label"><?php echo $transLang['LASTNAME']; ?></label>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="lastname" id="lastname" maxlength="50" value="<?php echo $session_user["0"]["users_lastname"]; ?>" /></div>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="lastname" id="lastname" maxlength="50" value="<?php echo $session_user["0"]["users_lastname"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } ?>/></div>
|
||||
<label for="email" class="col-sm-2 col-form-label"><?php echo $transLang['EMAIL']; ?></label>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="email" id="email" maxlength="100" value="<?php echo $session_user["0"]["users_email"]; ?>" /></div>
|
||||
<div class="col-sm-2"><input class="form-control" type="text" name="email" id="email" maxlength="100" value="<?php echo $session_user["0"]["users_email"]; ?>" <?php if (Registry::AUTHMETHOD == 'SAML') { echo "readonly "; } ?>/></div>
|
||||
</div>
|
||||
<?php if (Registry::AUTHMETHOD == 'INTERNAL') { ?>
|
||||
<div class="form-group row">
|
||||
<label for="password" class="col-sm-2 col-form-label"><?php echo $transLang['NEW'] . " " . $transLang['PASSWORD']; ?></label>
|
||||
<div class="col-sm-2"><input class="form-control" type="password" name="password" id="password" /></div>
|
||||
@@ -103,6 +133,7 @@
|
||||
<div class="col-sm-2"><input class="form-control" type="password" name="newpassword2" id="newpassword2" /></div>
|
||||
<div class="col-sm-4"><button type="submit" name="saveprofile" id="saveprofile" class="form-control btn btn-block btn-primary"><?php echo $transLang['SAVE']; ?></button></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user