nur-sery/nur_src/v/vp/AppDevauthPage.php

38 lines
752 B
PHP
Raw Normal View History

2023-12-03 22:10:18 +04:00
<?php
namespace nur\v\vp;
use nur\authz;
use nur\F;
use nur\v\page;
class AppDevauthPage extends AInitPage {
/** @var string nom de l'utilisateur connecté */
private $user;
function setup(): void {
if (!$this->isDevauthAllowed()) {
page::redirect($this->getLoginUrl());
}
$user = $this->getDevUsername();
if ($user) {
if (authz::manager()->casLogin($user, null)) {
$destUrl = F::get("d");
if ($destUrl) page::redirect($destUrl);
}
$retUrl = F::get("r");
if ($retUrl) page::redirect($retUrl);
} else {
$user = "NONE";
}
$this->user = $user;
}
function print(): void {
page::content_type("text/plain");
page::no_cache();
echo $this->user;
}
}