Implemented account system
This commit is contained in:
parent
51c20b55a0
commit
ace0de4063
25 changed files with 1543 additions and 40 deletions
|
@ -1,31 +1,29 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use GamesShop\ContainerHandler;
|
||||
use GamesShop\Login\LoginHandler;
|
||||
use GamesShop\Entities\Account\User;
|
||||
|
||||
/** @var User|null $activeUser */
|
||||
|
||||
$loginHandler = ContainerHandler::get(LoginHandler::class);
|
||||
?>
|
||||
|
||||
<?php if ($loginHandler->isLoggedIn()):
|
||||
$user = $loginHandler->getCurrentUser();
|
||||
?>
|
||||
<?php if ($activeUser !== null): ?>
|
||||
<div class="d-flex avatar justify-content-center">
|
||||
|
||||
<div class="avatar-icon h-100 position-relative me-2 ratio-1">
|
||||
<img src="<?= $user->getProfilePictureUrl(); ?>" class="rounded-circle h-100" alt="User Profile Picture" />
|
||||
<img src="<?= $activeUser->getProfilePictureUrl(); ?>" class="rounded-circle h-100" alt="User Profile Picture" />
|
||||
<div class="position-absolute bottom-0 end-0 ratio-1 d-flex align-items-center z-1 avatar-login-method">
|
||||
<i class="fa-brands <?= $user->getLoginMethod()->getIconClass() ?>"></i>
|
||||
<i class="fa-brands <?= $activeUser->getLoginMethod()->getIconClass() ?>"></i>
|
||||
<span class="position-absolute w-100 h-100 bottom-0 end-0 ratio-1 bg-body rounded-circle z-n1 avatar-login-method-icon"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<span class="me-2 h-3">
|
||||
<?= $user->getName() ?>
|
||||
<?= $activeUser->getName() ?>
|
||||
</span>
|
||||
<small class="text-muted">
|
||||
<?= $user->getPermission()->getHumanReadableName() ?>
|
||||
<?= $activeUser->getPermission()->getHumanReadableName() ?>
|
||||
</small>
|
||||
</div>
|
||||
<div class="h-100 d-flex align-items-center ms-2">
|
||||
|
|
|
@ -39,5 +39,7 @@ $resource = $resources->getResource($resourceEntry);
|
|||
<?= $this->section('content'); ?>
|
||||
</main>
|
||||
|
||||
<?= $this->section('modal') ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use GamesShop\ContainerHandler;
|
||||
use GamesShop\Login\LoginHandler;
|
||||
use GamesShop\Entities\Account\User;
|
||||
use GamesShop\Login\UserPermission;
|
||||
use GamesShop\Templates\NavigationHeader;
|
||||
|
||||
ContainerHandler::get(LoginHandler::class);
|
||||
$headers = [
|
||||
new NavigationHeader('My Keys', '/keys', UserPermission::PROVIDER),
|
||||
new NavigationHeader('Accounts', '/accounts', UserPermission::ADMIN)
|
||||
];
|
||||
|
||||
/** @var User|null $activeUser */
|
||||
$currentPermission = $activeUser === null ? UserPermission::NONE : $activeUser->getPermission();
|
||||
|
||||
?>
|
||||
|
||||
|
@ -15,7 +22,19 @@ ContainerHandler::get(LoginHandler::class);
|
|||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbar-content">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0"></ul>
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<?php foreach ($headers as $header):
|
||||
if (!$currentPermission->hasLevel($header->minimumPermission)) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<li class="nav-link">
|
||||
<a href="<?= $header->link ?>" class="nav-link"><?= $header->title ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?= $this->insert('layout/accountDisplay'); ?>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue