diff --git a/web/auth/login.php b/web/auth/login.php index 5275c9b..4e5c524 100644 --- a/web/auth/login.php +++ b/web/auth/login.php @@ -6,7 +6,7 @@ require_once __DIR__ . '/../inc/oidc.php'; session_start_safe(); if (current_user()) { - header('Location: /dashboard.php'); + header('Location: /profile.php'); exit; } diff --git a/web/auth/otp_setup.php b/web/auth/otp_setup.php new file mode 100644 index 0000000..5a8680e --- /dev/null +++ b/web/auth/otp_setup.php @@ -0,0 +1,25 @@ + 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; diff --git a/web/profile.php b/web/profile.php index 445fe96..774c260 100644 --- a/web/profile.php +++ b/web/profile.php @@ -128,8 +128,7 @@ $gps = ($membership && is_file($gps_file)) ? (json_decode(file_get_contents($gps_file), true)[$membership['id']] ?? null) : null; -$otp = kc_get_otp_credential($user['sub']); -$otp_setup_url = ALPID_BASE . '/realms/' . ALPID_REALM . '/account/#/security/signingin'; +$otp = kc_get_otp_credential($user['sub']); $is_adherent = $user['is_adherent'] || ($membership && $membership['status']===1 && $membership['date_fin_ts']>time()); @@ -350,8 +349,7 @@ require __DIR__ . '/views/layout.php'; - +