dadasd
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
require_once dirname(__DIR__) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\App;
|
||||
use App\AccountGate;
|
||||
use App\ConfigLoader;
|
||||
use App\KeycloakAuth;
|
||||
|
||||
@@ -12,7 +13,20 @@ session_start();
|
||||
|
||||
$projectRoot = dirname(__DIR__);
|
||||
$keycloakConfig = ConfigLoader::load($projectRoot, 'keycloak');
|
||||
$registrationConfig = ConfigLoader::load($projectRoot, 'registration');
|
||||
$auth = new KeycloakAuth($keycloakConfig);
|
||||
$accountGate = new AccountGate($registrationConfig);
|
||||
|
||||
if ($auth->isAuthenticated()) {
|
||||
$currentUser = is_array($_SESSION['desktop_auth']['user'] ?? null) ? $_SESSION['desktop_auth']['user'] : [];
|
||||
$accountCheck = $accountGate->checkUsername((string) ($currentUser['username'] ?? ''));
|
||||
|
||||
if (!($accountCheck['allowed'] ?? false)) {
|
||||
$auth->logout();
|
||||
header('Location: /auth/inactive/?message=' . urlencode((string) ($accountCheck['message'] ?? 'Dieses Konto ist noch nicht freigeschaltet.')), true, 302);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$auth->shouldShowDesktop()) {
|
||||
if ($auth->isConfigured()) {
|
||||
|
||||
Reference in New Issue
Block a user