From e051cade7865717466afe577298d9e9dd00ce728 Mon Sep 17 00:00:00 2001 From: Zorchenhimer Date: Sun, 10 Jan 2021 20:07:20 -0500 Subject: [PATCH] Allow the pin to be passed in via the URL Instead of only prompting the user for a pin, also allow it to be passed in as the URL parameter "pin". --- handlers.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/handlers.go b/handlers.go index 3b86a53..89367f5 100644 --- a/handlers.go +++ b/handlers.go @@ -190,6 +190,14 @@ func checkRoomAccess(w http.ResponseWriter, r *http.Request) bool { // Pin is incorrect. handlePinTemplate(w, r, "Incorrect PIN") return false + } else { + qpin := r.URL.Query().Get("pin") + if qpin != "" && qpin == settings.RoomAccessPin { + // Pin is correct. Save it to session and return true. + session.Values["pin"] = settings.RoomAccessPin + session.Save(r, w) + return true + } } // nope. display pin entry and return handlePinTemplate(w, r, "")