diff --git a/html/index.php b/html/index.php index e932135..ac002ab 100644 --- a/html/index.php +++ b/html/index.php @@ -36,6 +36,10 @@ function reload(): void { } function newPairing(): array { + if ($_REQUEST["csrfToken"] != $_SESSION["csrfToken"]) { + return [$_SESSION["left"], $_SESSION["right"]]; + } + return makeInitialPairing(session_id()); } diff --git a/html/styles/main.css b/html/styles/main.css index 8275936..f7ecf8d 100644 --- a/html/styles/main.css +++ b/html/styles/main.css @@ -151,6 +151,25 @@ h2 { position: relative; } +.separator .new-pairing { + position: absolute; + width: 100%; + bottom: 5vw; + text-align: center; +} + +.separator .new-pairing a, .separator .new-pairing a:visited { + text-decoration: none; + color: black; + border-radius: 3px; + display: inline-block; + padding: 10px; +} + +.separator .new-pairing a:hover { + text-decoration: underline; +} + .middle { width: 100%; position: absolute; diff --git a/view/fragments/mobSelection.php b/view/fragments/mobSelection.php index 55b369b..87505a0 100644 --- a/view/fragments/mobSelection.php +++ b/view/fragments/mobSelection.php @@ -6,6 +6,14 @@ ?>
+
+ " onclick="return false;" + data-hx-get="?ajax&new&csrfToken=" data-hx-target=".selection" data-hx-swap="outerHTML" + data-hx-ext="img-preload" data-loading-callback="startSpinner()" data-loaded-callback="stopSpinner()" + > + New Pairing + +