Plain-PHP fleet platform with id.andmore.pt SSO. Wires shared/platform-tools as a submodule (platform_update, backups, git/migration tools) like the other platforms. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
1.1 KiB
PHP
27 lines
1.1 KiB
PHP
<?php
|
|
require __DIR__ . '/../../config/db.php';
|
|
require __DIR__ . '/../../config/functions.php';
|
|
|
|
// Always clear the local session first.
|
|
$_SESSION = [];
|
|
session_destroy();
|
|
|
|
// Federated mode: always bounce through Andmore ID's logout endpoint so both
|
|
// the central sso_sessions row and the am_sso cookie are destroyed AND
|
|
// id.andmore.pt's own PHP session is cleared. The old check for the am_sso
|
|
// cookie was a bug: if the cookie happened to be absent from $_COOKIE (e.g.
|
|
// due to a Secure-flag or SameSite edge case), the central logout was skipped,
|
|
// leaving id.andmore.pt's session alive. That session then caused a redirect
|
|
// loop — id.andmore.pt auto-logged the user in and bounced them back to the
|
|
// login stub, which immediately bounced them back to id.andmore.pt, ad inf.
|
|
//
|
|
// Return to the public landing page (not the login stub) so the post-logout
|
|
// redirect from id.andmore.pt lands on a real page and the chain stops.
|
|
if (identity_is_federated()) {
|
|
header('Location: ' . ANDMORE_ID_URL . 'auth/logout.php?return_to=' . urlencode(APP_BASE_URL));
|
|
exit;
|
|
}
|
|
|
|
header('Location: ' . base_url('views/auth/login.php'));
|
|
exit;
|