From cf4f11b8071c9d9151a052ac7d598f7a041a9aab Mon Sep 17 00:00:00 2001
From: Jan Hartig <jan.hartig@ptb.de>
Date: Fri, 17 Nov 2023 14:53:22 +0100
Subject: [PATCH] Fix validation on url call

---
 roomunlock.html | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/roomunlock.html b/roomunlock.html
index 8d53073..89f2b16 100644
--- a/roomunlock.html
+++ b/roomunlock.html
@@ -73,7 +73,7 @@
     <div id="hiddenFieldError" class="hiddenField error" aria-hidden="true">
         <p id="errorText">empty</p>
     </div>
-    <input type="text" id="room" placeholder="Raumname" minlength="2" required>
+    <input type="text" id="room" placeholder="Raumname" minlength=2 required>
     <button type="button" onclick="process_form()" id="unlock">Freischalten</button>
     <br>
     <p style="font-weight: bold;">oder...</p>
@@ -99,9 +99,9 @@
         const roomUrl = document.getElementById('roomUrl');
 
         let room = window.location.href.substring(window.location.href.lastIndexOf('/') + 1)
-        if (room !== "raumfreischaltung" && room !== "") {
-            roomField.value = room;
-            unlockButton.click();
+        if (room.length >= 2 && room !== "raumfreischaltung") {
+            roomField.value = room
+            get_room(room)
         }
 
         function get_room(_room) {
-- 
GitLab