2023-05-21 18:15:04 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
use Misuzu\Auth\AuthTokenCookie;
|
|
|
|
|
2023-09-08 20:40:48 +00:00
|
|
|
$urls = $msz->getURLs();
|
2023-08-03 01:35:08 +00:00
|
|
|
if(CSRF::validateRequest()) {
|
|
|
|
$tokenInfo = $msz->getAuthInfo()->getTokenInfo();
|
|
|
|
|
|
|
|
if($tokenInfo->hasImpersonatedUserId()) {
|
|
|
|
$impUserId = $tokenInfo->getImpersonatedUserId();
|
2023-05-21 18:15:04 +00:00
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
$tokenBuilder = $tokenInfo->toBuilder();
|
|
|
|
$tokenBuilder->removeImpersonatedUserId();
|
|
|
|
$tokenInfo = $tokenBuilder->toInfo();
|
|
|
|
|
|
|
|
AuthTokenCookie::apply($tokenPacker->pack($tokenInfo));
|
2023-09-08 20:40:48 +00:00
|
|
|
Tools::redirect($urls->format('manage-user', ['user' => $impUserId]));
|
2023-08-03 01:35:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2023-05-21 18:15:04 +00:00
|
|
|
|
2023-09-08 20:40:48 +00:00
|
|
|
Tools::redirect($urls->format('index'));
|