<?php
namespace Misuzu;

use Misuzu\Users\User;

if(!isset($userInfoReal) || !$authToken->hasImpersonatedUserId() || !CSRF::validateRequest()) {
    url_redirect('index');
    return;
}

$authToken->removeImpersonatedUserId();
$authToken->applyCookie();

$impUserId = User::hasCurrent() ? User::getCurrent()->getId() : 0;

url_redirect(
    $impUserId > 0 ? 'manage-user' : 'index',
    ['user' => $impUserId]
);
