38 lines
		
	
	
		
			752 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			752 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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;
 | |
|   }
 | |
| }
 |