misuzu/public-legacy/auth/revert.php

22 lines
598 B
PHP

<?php
namespace Misuzu;
use Misuzu\Auth\AuthTokenCookie;
if(CSRF::validateRequest()) {
$tokenInfo = $msz->authInfo->tokenInfo;
if($tokenInfo->hasImpersonatedUserId) {
$impUserId = $tokenInfo->impersonatedUserId;
$tokenBuilder = $tokenInfo->toBuilder();
$tokenBuilder->removeImpersonatedUserId();
$tokenInfo = $tokenBuilder->toInfo();
AuthTokenCookie::apply($tokenPacker->pack($tokenInfo));
Tools::redirect($msz->urls->format('manage-user', ['user' => $impUserId]));
return;
}
}
Tools::redirect($msz->urls->format('index'));