- auth/otp_setup.php : déclenche CONFIGURE_TOTP via kc_action Keycloak - Tuile OTP pointe vers otp_setup.php (plus de lien externe vers la console) - Bouton Activer en btn-primary, Reconfigurer en btn-outline - login.php : redirige vers /profile.php si déjà connecté Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
665 B
PHP
25 lines
665 B
PHP
<?php
|
|
require_once __DIR__ . '/../inc/config.php';
|
|
require_once __DIR__ . '/../inc/auth.php';
|
|
|
|
session_start_safe();
|
|
require_login();
|
|
|
|
$state = bin2hex(random_bytes(16));
|
|
$nonce = bin2hex(random_bytes(16));
|
|
$_SESSION['oidc_state'] = $state;
|
|
$_SESSION['oidc_nonce'] = $nonce;
|
|
$_SESSION['next_url'] = '/profile.php';
|
|
|
|
$url = ALPID_AUTH_URL . '?' . http_build_query([
|
|
'client_id' => ALPID_CLIENT_ID,
|
|
'response_type' => 'code',
|
|
'scope' => 'openid profile email',
|
|
'redirect_uri' => CALLBACK_URL,
|
|
'state' => $state,
|
|
'nonce' => $nonce,
|
|
'kc_action' => 'CONFIGURE_TOTP',
|
|
]);
|
|
|
|
header('Location: ' . $url);
|
|
exit;
|