mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-28 16:29:55 +02:00
UI improvements, contact windows, fixed #196
This commit is contained in:
parent
5ac0e9f1fa
commit
184322e2d2
6 changed files with 493 additions and 360 deletions
|
@ -266,4 +266,30 @@ class ProfileController extends Controller
|
|||
Auth::logoutEverywhereElse();
|
||||
}
|
||||
|
||||
public function tokenWell(Request $request, Response $response)
|
||||
{
|
||||
global $container;
|
||||
$csrf = $container->get('csrf');
|
||||
|
||||
// Get CSRF token name and value
|
||||
$csrfTokenName = $csrf->getTokenName();
|
||||
$csrfTokenValue = $csrf->getTokenValue();
|
||||
|
||||
// Check if tokens exist
|
||||
if (!$csrfTokenName || !$csrfTokenValue) {
|
||||
$errorResponse = json_encode(['error' => 'CSRF tokens not found']);
|
||||
$response->getBody()->write($errorResponse);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
// Create JSON response in the expected format
|
||||
$csrfResponse = json_encode([
|
||||
$csrfTokenName => $csrfTokenValue
|
||||
]);
|
||||
|
||||
// Write response body and return with JSON header
|
||||
$response->getBody()->write($csrfResponse);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue