Replace PHP WIP with vanilla version
This commit is contained in:
26
src/app/public/user/logged-on.php
Normal file
26
src/app/public/user/logged-on.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once '../../lib/start.php';
|
||||
|
||||
use MyPrayerJournal\Constants;
|
||||
|
||||
$auth0->exchange("{$_ENV[Constants::BASE_URL]}/user/logged-on");
|
||||
|
||||
$nextUrl = '/journal';
|
||||
if (array_key_exists(Constants::LOG_ON_STATE, $_GET)) {
|
||||
$nonce = base64_decode(urldecode($_GET[Constants::LOG_ON_STATE]));
|
||||
[$verify, $newNext] = explode('|', $_COOKIE[Constants::COOKIE_REDIRECT]);
|
||||
if ($verify == $nonce && $newNext && str_starts_with($newNext, '/') && !str_starts_with($newNext, '//')) {
|
||||
$nextUrl = $newNext;
|
||||
}
|
||||
}
|
||||
|
||||
setcookie(Constants::COOKIE_REDIRECT, '', [
|
||||
'expires' => -1,
|
||||
'secure' => true,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Strict'
|
||||
]);
|
||||
header("Location: $nextUrl");
|
||||
exit;
|
||||
Reference in New Issue
Block a user