Browse Source

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".
pull/1/head
Zorchenhimer 2 years ago
parent
commit
e051cade78
  1. 8
      handlers.go

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

Loading…
Cancel
Save