600) { unset($_SESSION['sassly_choose']); header('Location: ' . $paths['login'], true, 302); exit; } // Re-read: only users that are still active and still belong to this identity. $candidates = []; foreach (sassly_find_or_link_users($pending['identity']) as $u) { if (in_array((string)$u['id'], $pending['user_ids'], true)) { $candidates[(string)$u['id']] = $u; } } if ($candidates === []) { unset($_SESSION['sassly_choose']); sassly_render_page(403, 'Akun tidak aktif', 'Tidak ada akun aktif untuk dipilih. Hubungi admin.', true); exit; } if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST') { $chosen = (string)($_POST['user_id'] ?? ''); if (!sassly_csrf_valid($_POST['csrf'] ?? null) || !isset($candidates[$chosen])) { sassly_render_page(400, 'Pilihan tidak valid', 'Silakan pilih lagi.', false, $paths['choose']); exit; } sassly_complete_login($pending['identity'], $candidates[$chosen]); } header('Content-Type: text/html; charset=utf-8'); header('Cache-Control: no-store'); ?>