2FA/Remember Me Implementierung

Userprofile Implementierung

Datatables Padding Anpassungen

Usercontroller und User um Mobile erweitert
This commit is contained in:
Spitzer_Daniel
2023-08-17 09:42:18 +02:00
parent 1887ad222d
commit f95d0b0074
21 changed files with 1643 additions and 554 deletions
+1 -1
View File
@@ -407,7 +407,7 @@ if ($devices->power != "0.0") {
</div>
<div>
<table style="font-size:12px;" id="datatable"
class="table table-striped table-hover">
class="table table-striped table-hover table-sm">
<thead>
<tr>
<th>Port-ID</th>
+3 -5
View File
@@ -41,10 +41,10 @@ $pagination_entity_name = "Device";
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table id="datatable" class="table table-striped table-hover">
<table id="datatable" class="table table-striped table-hover table-sm font-13">
<thead>
<tr>
<th>Device Name</th>
<th style="min-width: 250px;">Device Name</th>
<th class="text-center">Geräte Typ</th>
<th class="text-center">Hersteller</th>
<th class="text-center">Pop</th>
@@ -123,9 +123,7 @@ $pagination_entity_name = "Device";
<a href="<?= self::getUrl("Device", "delete", ["id" => $device->id]) ?>"
onclick="if(!confirm('Device wirklich löschen?')) return false;" class="text-danger"
title="Löschen"><i class="fas fa-trash "></i></a>
</td>
</tr>
<?php endforeach; ?>
@@ -148,7 +146,7 @@ $pagination_entity_name = "Device";
var columndefs = {type: 'ip-address', targets: 4};
var columnfilter = [9];
var columnoptions='<option value=""></option><option value="OK">OK</option><option value="AGED">AGED</option><option value="N/A">N/A</option>';
$(document).ready(function () {
});
+1 -1
View File
@@ -39,7 +39,7 @@ $pagination_entity_name = "Devicemanufactor";
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table id="datatable" class="table table-striped table-hover">
<table id="datatable" class="table table-striped table-hover table-sm">
<thead>
<tr>
<th class="text-center">Name</th>
+1 -1
View File
@@ -40,7 +40,7 @@ $pagination_entity_name = "Devicetype";
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table id="datatable" class="table table-striped table-hover">
<table id="datatable" class="table table-striped table-hover table-sm">
<thead>
<tr>
<th>Name</th>
+1 -1
View File
@@ -40,7 +40,7 @@ $pagination_entity_name = "Pops";
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table id="datatable" class="table table-striped table-hover">
<table id="datatable" class="table table-striped table-hover table-sm">
<thead>
<tr>
<th>Name</th>
+4
View File
@@ -41,6 +41,10 @@
<label for="email">Email:</label>
<input type="text" id="email" name="email" class="form-control" value="<?=$user->email?>" />
</div>
<div class="form-group">
<label for="mobile">Handy Nr.:</label>
<input type="text" id="mobile" placeholder="+436641234xxx" name="mobile" class="form-control" value="<?=$user->mobile?>" />
</div>
<div class="form-group">
<label for="address_id">Firma/Person:</label>
<select name="address_id" id="address_id" class="form-control">
+142 -82
View File
@@ -1,99 +1,159 @@
<?php
$siteTitle = "Benutzer";
$siteTitle = "Benutzer";
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Benutzer";
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Benutzer";
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<style>
.fa-exclamation-triangle, .fa-envelope, .fa-mobile-retro {
font-size: 18px;
}
.fa-exclamation-triangle {
color: red;
}
</style>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item active">Benutzer</li>
</ol>
</div>
<h4 class="page-title">Benutzer</h4>
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Benutzer</li>
</ol>
</div>
<h4 class="page-title">Benutzer</h4>
</div>
</div>
</div>
</div>
<!-- end page title -->
<!-- Main content -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<div class="float-left">
<h4 class="header-title">Benutzerliste</h4>
<p class="sub-header">
<?php if(is_array($filter) && count($filter)): ?>
<?php if($filter['address_id']): ?>
Zugehörig zu <?=(AddressModel::getOne($filter["address_id"])->getCompanyOrName())?><br />
<?php endif; ?>
<?php else: ?>
Zeige alle Benutzer
<?php endif; ?>
</p>
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<div class="overflow-auto">
<div class="float-left">
<h4 class="header-title">Benutzerliste</h4>
<p class="sub-header">
<?php if (is_array($filter) && count($filter)): ?>
<?php if ($filter['address_id']): ?>
Zugehörig zu <?= (AddressModel::getOne($filter["address_id"])->getCompanyOrName()) ?>
<br/>
<?php endif; ?>
<?php else: ?>
<?php endif; ?>
</p>
</div>
<div class="float-right">
<?php if (is_array($filter) && count($filter) && is_numeric($filter['address_id'])): ?>
<a class="btn btn-primary"
href="<?= self::getUrl("User", "add", ['address_id' => $filter['address_id']]) ?>"><i
class="fas fa-plus"></i> Neuen Benutzer anlegen</a>
<?php else: ?>
<a class="btn btn-primary" href="<?= self::getUrl("User", "add") ?>"><i
class="fas fa-plus"></i> Neuen Benutzer anlegen</a>
<?php endif; ?>
</div>
</div>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<div style="clear: both;" class="mt-2">
<table id="datatable" class="table table-striped table-hover font-13 table-sm ">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Firma / Person</th>
<th>Email</th>
<th>Handy Nr.</th>
<th>2FA</th>
<th>Admin</th>
<th>Techniker</th>
<th></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user):
if ($user->twofactor == 0) {
$twoFactortype = '<i class="fa fa-exclamation-triangle"><span style="display: none">N/A</span></i>';
} else if ($user->twofactor == 1) {
$twoFactortype = '<i class="fa-light fa-envelope"><span style="display: none">Mail</span></i>';
} else if ($user->twofactor == 2) {
$twoFactortype = '<i class="fa-light fa-mobile-retro"><span style="display: none">SMS</span></i>';
}
?>
<tr>
<td><?= $user->username ?></td>
<td><?= $user->name ?></td>
<td><?= ($user->address->company) ? $user->address->company : $user->address->getFullName() ?></td>
<td><?= $user->email ?></td>
<td><?= $user->mobile ?></td>
<td class="text-center"><?= $twoFactortype ?></td>
<td><?= ($user->isAdmin()) ? "Ja" : "Nein" ?></td>
<td><?= ($user->is("Technician")) ? "Ja" : "Nein" ?></td>
<td class="edit-width"
style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("User", "edit", ['id' => $user->id]) ?>"
title="User bearbeiten"><i class="far fa-edit"></i></a>
<?php if ($user->id > 1): ?>
<a href="<?= self::getUrl("User", "delete", ['id' => $user->id]) ?>"
class="text-danger" title="User löschen"
onclick="if(!confirm('Benutzer wirklich löschen?')) return false;"><i
class="far fa-trash-alt"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
<div class="float-right">
<?php if(is_array($filter) && count($filter) && is_numeric($filter['address_id'])): ?>
<a class="btn btn-primary" href="<?=self::getUrl("User", "add", ['address_id' => $filter['address_id']])?>"><i class="fas fa-plus"></i> Neuen Benutzer anlegen</a>
<?php else: ?>
<a class="btn btn-primary" href="<?=self::getUrl("User", "add")?>"><i class="fas fa-plus"></i> Neuen Benutzer anlegen</a>
<?php endif; ?>
</div>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Username</th>
<th>Name</th>
<th>Firma / Person</th>
<th>Email</th>
<th>Admin</th>
<th>Techniker</th>
<th></th>
</tr>
<?php foreach($users as $user): ?>
<tr>
<td><?=$user->username?></td>
<td><?=$user->name?></td>
<td><?=($user->address->company) ? $user->address->company : $user->address->getFullName()?></td>
<td><?=$user->email?></td>
<td><?=($user->isAdmin()) ? "Ja" : "Nein"?></td>
<td><?=($user->is("Technician")) ? "Ja" : "Nein"?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("User","edit", ['id' => $user->id])?>" title="User bearbeiten"><i class="far fa-edit"></i></a>
<?php if($user->id > 1): ?>
<a href="<?=self::getUrl("User","delete", ['id' => $user->id])?>" class="text-danger" title="User löschen" onclick="if(!confirm('Benutzer wirklich löschen?')) return false;"><i class="far fa-trash-alt"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
<script type="text/javascript">
var hidesearch = [8];
var columndefs = {type: 'ip-address', targets: 4};
var columnfilter = [5];
var columnoptions = '<option value=""></option><option value="SMS">SMS</option><option value="Mail">Mail</option><option value="N/A">N/A</option>';
$(document).ready(function () {
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
+161
View File
@@ -0,0 +1,161 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<!-- start page title -->
<style>
.fa-new-code {
cursor: pointer;
color: #007bff;
font-size: 16px;
margin-left: 5px;
}
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a
href="<?= self::getUrl("UserProfile") ?>">Benutzerprofil</a></li>
<li class="breadcrumb-item active">bearbeiten</li>
</ol>
</div>
<h4 class="page-title">Benutzerprofil</h4>
</div>
</div>
</div>
<!-- end page title -->
<?php
$twofa = $userprofile->twofactor;
if ($twofa == 0) {
$formAction = self::getUrl("UserProfile", 'save');
} elseif ($twofa == 1) {
$formAction = self::getUrl("UserProfile", 'save');
} elseif ($twofa == 2) {
$formAction = self::getUrl("UserProfile", 'save');
}
?>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2">Allgemeine Daten</h4>
<form class="form-horizontal" method="post"
action="<?= $formAction ?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?= $devicetypes->id ?>"/>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Name *</label>
<div class="col-lg-3">
<input type="text" class="form-control input-control" name="name" id="name"
value="<?= $userprofile->name ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="email">Email *</label>
<div class="col-lg-3">
<input type="text" class="form-control input-control" name="email" id="email"
required="required"
value="<?= $userprofile->email ?>" <?php if ($twofa == 1) : ?> disabled="disabled" <?php endif; ?> />
</div>
<?php if ($twofa == 1) : ?>
<div class="col-lg-4 col-form-label">
<span class="info-span alert alert-info"> Um die Email Adresse zu ändern bitte 2FA auf SMS umschalten.</span>
</div>
<?php endif; ?>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="olt">Mobiltelefon</label>
<div class="col-lg-3">
<input placeholder="+4366411223344" type="text" class="form-control input-control"
name="mobile" id="mobile"
value="<?= $userprofile->mobile ?>" <?php if ($twofa == 2) : ?> disabled="disabled" <?php endif; ?>/>
</div>
<?php if ($twofa == 2) : ?>
<div class="col-lg-4 col-form-label">
<span class="info-span alert alert-info"> Um die Mobilnummer zu ändern bitte 2FA auf Email umschalten.</span>
</div>
<?php endif; ?>
</div>
<div id="verification2fa" class="form-group row" style="display:none">
<label class="col-lg-2 col-form-label" for="olt">Verifizierungscode<i
data-codetype="<?= $twofa ?>"
class="fa-solid fa-arrows-rotate fa-new-code" id="new-authcode"
title="Neuen Code anfordern."></i></label>
<div class="col-lg-2">
<input type="number" min="0" max="99999" class="form-control"
name="code" id="code"/>
</div>
<label class="col-lg-4 col-form-label" for="olt">Verifizierungscode wurde versendet
(5 Minuten gültig)</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button id="submit" type="submit" data-codetype="<?= $twofa ?>"
class="btn btn-primary">Speichern
</button>
<a href="/UserProfile">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var verficationtype;
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/UserProfile/api?do=checkverfication", {}).done(function (data) {
verficationtype = data.data.verficationtype;
});
$('form').submit(function (e) {
var me = this;
if ($('#verification2fa').is(":hidden")) {
if (verficationtype > 0) {
e.preventDefault();
$('.input-control').attr('readonly', true);
$('#verification2fa').show();
$('#code').attr("required", true);
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/UserProfile/api?do=sendcode&twofactor=" + verficationtype, {}).done(function (data) {
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "/Dashboard";
});
} else {
}
}
});
$("body").on("click", "#new-authcode", function (event) {
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/UserProfile/api?do=sendcode&twofactor=" + $('#new-authcode').data('codetype'), {}).done(function (data) {
$("#new-authcode").hide(0).delay(5000).show(0);
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "/Dashboard";
});
});
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
+201
View File
@@ -0,0 +1,201 @@
<?php
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<style>
.fa-exclamation-triangle {
font-size: 19px;
color: red;
}
.fa-new-code {
cursor: pointer;
color: #007bff;
font-size: 16px;
margin-left: 5px;
}
.fa-envelope, .fa-mobile-retro {
font-size: 25px;
vertical-align: sub;
margin-right: 5px;
}
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
</ol>
</div>
<h4 class="page-title">Benutzerprofil</h4>
</div>
</div>
</div>
<!-- end page title -->
<?php
if ($userprofile->twofactor == 0) {
$twoFactorsym = '<i class="fa fa-exclamation-triangle mr-1"></i>';
$twoFactorbtn = '<button class="btn btn-success mb-3 ">Aktivieren</button>';
$twoFactortype = '<div class="col-lg-2">
<select class="select2 form-control" name="twofactor" id="twofactor">
<option value="1">Email</option>
<option value="2">SMS</option>
</select></div>';
$twoFactorFormaction = "code2faaction";
} else if ($userprofile->twofactor == 1) {
$twoFactorsym = '<i class="fa-regular fa-circle-check mr-1"></i>';
$twoFactorbtn = '<button class="btn btn-success mb-3 ">Ändern zu SMS</button>';
$twoFactortype = '<label class="col-lg-2 col-form-label"><input type="hidden" name="twofactor" value="2"/><i class="fa-light fa-envelope"></i> Email</label>';
$twoFactorFormaction = "change2faaction";
} else if ($userprofile->twofactor == 2) {
$twoFactorsym = '<i class="fa-regular fa-circle-check mr-1"></i>';
$twoFactorbtn = '<button class="btn btn-success mb-3 ">Ändern zu Email</button>';
$twoFactortype = '<label class="col-lg-2 col-form-label"><input type="hidden" name="twofactor" value="1"/><i class="fa-light fa-mobile-retro"></i> Mobiltelefon (SMS)</label>';
$twoFactorFormaction = "change2faaction";
}
?>
<i class="bi bi-exclamation-triangle"></i>
<div class="row">
<div class="col-lg">
<div class="card">
<div class="card-body">
<h4 class=" mb-2">Allgemeine Daten</h4>
<div class="form-group row">
<div class="col-lg-2 font-weight-500">Name</div>
<div class="col-lg-10">
<?= $userprofile->name ?>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2 font-weight-500">Email</div>
<div class="col-lg-10">
<?= $userprofile->email ?>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2 font-weight-500">Mobiltelefon</div>
<div class="col-lg-10">
<?= $userprofile->mobile ?>
</div>
</div>
<div class="form-group row">
<div class="col-lg-10">
<a class="btn btn-primary mb-2"
href="<?= self::getUrl("UserProfile", "edit") ?>">Bearbeiten</a>
</div>
</div>
<div class="w-100 border-bottom"></div>
<h4 class=" mb-2 mt-3">Passwort ändern</h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("UserProfile", "changepwd") ?>">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="oldpwd">altes Passwort</label>
<div class="col-lg-2">
<input type="password" class="form-control" name="oldpwd" id="oldpwd"
value="">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="newpwd">neues Passwort</label>
<div class="col-lg-2">
<input type="password" class="form-control" name="newpwd" id="newpwd"
value="">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="checkpwd">Passwort bestätigen</label>
<div class="col-lg-2">
<input type="password" class="form-control" name="checkpwd" id="checkpwd"
value="">
</div>
</div>
<div class="form-group row">
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</form>
<div class="w-100 border-bottom"></div>
<h4 class="form-group mb-2 mt-3">2FA</h4>
<?php if (!$verification || $verification == 0): ?>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("UserProfile", $twoFactorFormaction) ?>">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="twofactor"><?= $twoFactorsym ?>
Zwei-Faktor-Authentifizierung</label>
<?= $twoFactortype ?>
<div class="col-lg-7">
<?= $twoFactorbtn ?>
</div>
</div>
</form>
<?php elseif ($verification == 1 || $verification == 2) :
if ($verification == 1) {
$verificationType = "Email";
} elseif ($verification == 2) {
$verificationType = "SMS";
}
?>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("UserProfile", "activate2faaction") ?>">
<div class="row">
<div class="col-lg-2"></div>
<label class="col-lg-3 col-form-label"
style="vertical-align: top;font-size: 15px;color: #000;"> Code wurde
per <?php echo $verificationType; ?> verschickt (5 Minuten gültig)</label>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="code">Verifizierungscode: <i
data-codetype="<?= $verification ?>"
class="fa-solid fa-arrows-rotate fa-new-code" id="new-authcode"
title="Neuen Code anfordern."></i></label>
<div class="col-lg-2">
<input type="number" required min="0" max="99999" class="form-control" name="code"
id="code"
value="">
<input type="hidden" name="twofactor" value="<?php echo $verification; ?>"/>
</div>
<div class="col-lg-7">
<?= $twoFactorbtn ?>
<a href="/UserProfile">
<button type="button" class="btn btn-secondary mb-3">Abbrechen</button>
</a>
</div>
</div>
</form>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [5];
$(document).ready(function () {
$("body").on("click", "#new-authcode", function (event) {
$.getJSON("https://<?= $_SERVER['SERVER_NAME']; ?>/UserProfile/api?do=sendcode&twofactor=" + $('#new-authcode').data('codetype'), {}).done(function (data) {
$("#new-authcode").hide(0).delay(5000).show(0);
}).fail(function (jqxhr, textStatus, error) {
window.location.href = "/Dashboard";
});
});
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
+137 -56
View File
@@ -1,72 +1,153 @@
<!DOCTYPE html>
<html>
<?php
if ($requesttype == "2fa" || $requesttype == "false2fa") {
$userInput = 'value="' . $request['Username'] . '" readonly';
$pwdInput = 'value="' . $request['Password'] . '" readonly';
$error = '';
if ($requesttype == "false2fa") {
$error = '<div class="alert alert-danger" role="alert">Verifizierungscode falsch oder abgelaufen</div>';
}
$twoFactorInput = '
<div class="container">
<div class="row justify-content-center">
<div class=" mb-1">
<label class="col-form-label" for="olt">Verifizierungscode <i
class="fa-solid fa-arrows-rotate fa-new-code text-primary ml-1 cursor-pointer" id="new-authcode"
title="Neuen Code anfordern."></i></label>
</div>
</div>
<div class="row justify-content-center">
<div class="mb-0 col-5">
<input type="number" required min="0" max="99999" class="form-control"
name="TwofactorCode" id="TwofactorCode"/>
</div>
</div>
<div class="row justify-content-center mt-2">
<div class="text-center alert alert-primary">Verifizierungscode wurde versendet<br>
(5 Minuten gültig)</div>
</div>
<div class="row justify-content-center mb-3 mt-1">
<div class="form-check">
<input type="checkbox" value="true" name="Remember" class="form-check-input">
<label class="form-check-label text-bold" for="Remember">
angemeldet bleiben
</label>
</div>
</div>
</div>
';
} elseif ($requesttype == "falselogin") {
$error = '<div class="alert alert-danger text-center" role="alert">Benutzer oder Passwort falsch</div>';
} else {
$userInput = '';
$pwdInput = '';
$twoFactorInput = '';
$error = '';
}
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?=MFAPPNAME_FULL?> | Log in</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="assets/images/favicon.ico">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?= MFAPPNAME_FULL ?> | Log in</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="assets/images/favicon.ico">
<link rel="stylesheet" href="<?=self::getResourcePath()?>fontawesome/css/all.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?=self::getResourcePath()?>css/adminlte.css">
<link rel="stylesheet" href="<?=self::getResourcePath()?>css/fonts.css?<?=date('U')?>">
<link rel="stylesheet" href="<?=self::getResourcePath()?>css/main.css?<?=date('U')?>">
<!-- jQuery -->
<script src="<?=self::getResourcePath()?>plugins/jquery/jquery.min.js"></script>
<link rel="stylesheet" href="<?= self::getResourcePath() ?>fontawesome/css/all.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?= self::getResourcePath() ?>css/adminlte.css">
<link rel="stylesheet" href="<?= self::getResourcePath() ?>css/fonts.css?<?= date('U') ?>">
<link rel="stylesheet" href="<?= self::getResourcePath() ?>css/main.css?<?= date('U') ?>">
<!-- jQuery -->
<script src="<?= self::getResourcePath() ?>plugins/jquery/jquery.min.js"></script>
<style>
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
.alert-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
.alert-primary {
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;
}
.cursor-pointer {
cursor: pointer;
}
</style>
</head>
<body class="hold-transition login-page" onload="setFocus()">
<div class="login-box">
<div class="login-logo">
<a href="<?=self::getUrl("/")?>"><img src="<?=self::getResourcePath()?>assets/images/<?=MFAPPNAME_SLUG?>-logo.png" /></a>
</div>
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">Bitte einloggen</p>
<form action="" method="post">
<input type="hidden" name="action" value="mfLogin_Login" class="form-control nosave" />
<div class="input-group mb-3">
<input type="text" name="Username" id="mfUsername" class="form-control" placeholder="Benutzer">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" name="Password" class="form-control" placeholder="Passwort">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
</div>
<!-- /.col -->
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block">Einloggen</button>
</div>
<!-- /.col -->
</div>
</form>
<div class="login-logo">
<a href="<?= self::getUrl("/") ?>"><img
src="<?= self::getResourcePath() ?>assets/images/<?= MFAPPNAME_SLUG ?>-logo.png"/></a>
</div>
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">Bitte einloggen</p>
<form action="" method="post">
<input type="hidden" name="action" value="mfLogin_Login" class="form-control nosave"/>
<div class="input-group mb-3">
<input type="text" name="Username" id="mfUsername" class="form-control"
placeholder="Benutzer" <?= $userInput ?>>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" name="Password" class="form-control" placeholder="Passwort" <?= $pwdInput ?>>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<?= $twoFactorInput ?>
<?= $error ?>
<div class="row">
<div class="col-8">
</div>
<!-- /.col -->
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block">Einloggen</button>
</div>
<!-- /.col -->
</div>
</form>
</div>
<!-- /.login-card-body -->
</div>
<!-- /.login-card-body -->
</div>
</div>
<!-- /.login-box -->
<script type="text/javascript">
function setFocus() {
document.getElementById('mfUsername').focus();
}
document.getElementById('mfUsername').focus();
}
$('body').on('click', '#new-authcode', function (event) {
$('#TwofactorCode').remove();
$('form').submit();
});
</script>
</body>
+4 -3
View File
@@ -23,11 +23,12 @@
</li>
<li>
<a class="nav-link nav-user mr-0" href="#">
<a class="nav-link nav-user mr-0" href="<?php if($me->is(["Admin"])): ?><?=self::getUrl("UserProfile")?> <?php endif; ?>">
<!-- <img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" alt="user-image" class="rounded-circle"> -->
<i style="font-size: 24px; border-radius: 50%;" class="fas fa-user-secret text-white img-circle bg-info"></i>
<!-- <i style="font-size: 24px; border-radius: 50%;" class="fas fa-user-secret text-white img-circle bg-info"></i>-->
<i class="fa-sharp fa-light fa-gear text-white img-circle font-15 "></i>
<span class="pro-user-name ml-1">
<?=$me->username?>
<?=$me->username?>
</span>
</a>
</li>