alpinux-portail/web/auth/otp_setup.php
Alpinux f5f831dfb0 OTP : configuration via kc_action, login redirige vers profil
- 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>
2026-05-04 00:46:05 +02:00

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;