+6
-3
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// If already logged in, redirect
|
||||
if (isset($_SESSION['neptune_loggedin']) && $_SESSION['neptune_loggedin'] === true) {
|
||||
header('Location: /');
|
||||
exit;
|
||||
@@ -10,7 +9,11 @@ if (isset($_SESSION['neptune_loggedin']) && $_SESSION['neptune_loggedin'] === tr
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
// Check for auth callback from Jakach Auth
|
||||
// Detect the correct callback URL
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost:8080';
|
||||
$callbackUrl = "$scheme://$host/login.php";
|
||||
|
||||
if (isset($_GET['auth'])) {
|
||||
$auth_token = $_GET['auth'];
|
||||
$check_url = "https://auth.jakach.ch/api/auth/check_auth_key.php?auth_token=" . urlencode($auth_token);
|
||||
@@ -98,7 +101,7 @@ if (isset($_GET['auth'])) {
|
||||
<div class="alert alert-success py-2 small"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="https://auth.jakach.ch/?send_to=<?= urlencode('http://' . ($_SERVER['HTTP_HOST'] ?? 'localhost:8080') . '/login.php') ?>" class="btn btn-jakach w-100 py-2 mb-2">
|
||||
<a href="https://auth.jakach.ch/?send_to=<?= urlencode($callbackUrl) ?>" class="btn btn-jakach w-100 py-2 mb-2">
|
||||
<i class="fas fa-right-to-bracket me-2"></i>Log in with Jakach Auth
|
||||
</a>
|
||||
<small class="text-secondary">First user automatically becomes admin</small>
|
||||
|
||||
Reference in New Issue
Block a user