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".
This commit is contained in:
Zorchenhimer 2021-01-10 20:07:20 -05:00
parent ebc51f938c
commit e051cade78
1 changed files with 8 additions and 0 deletions

View File

@ -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, "")