Trim PIN of spaces

Fixes #88
This commit is contained in:
Zorchenhimer 2019-04-22 11:50:42 -04:00
parent 40f4cc72ae
commit 0a4ff49cbb
2 changed files with 2 additions and 1 deletions

View File

@ -478,6 +478,7 @@ var commands = &CommandControl{
case AccessPin:
// A pin/password was provided, use it.
if len(args) == 2 {
// TODO: make this a bit more robust. Currently, only accepts a single word as a pin/password
settings.RoomAccessPin = args[1]
// A pin/password was not provided, generate a new one.

View File

@ -179,7 +179,7 @@ func checkRoomAccess(w http.ResponseWriter, r *http.Request) bool {
http.Error(w, "Unable to get session data", http.StatusInternalServerError)
}
postPin := r.Form.Get("txtInput")
postPin := strings.TrimSpace(r.Form.Get("txtInput"))
common.LogDebugf("Received pin: %s\n", postPin)
if postPin == settings.RoomAccessPin {
// Pin is correct. Save it to session and return true.