From 9fccb563e1f086c25f9c142b6fdc884627e3c9db Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Mon, 16 Oct 2023 15:00:33 +0100 Subject: [PATCH] Respond with OTP error message --- server/otp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/otp.go b/server/otp.go index b9bf44d..a87ef18 100644 --- a/server/otp.go +++ b/server/otp.go @@ -9,6 +9,7 @@ import ( "github.com/google/uuid" "github.com/julienschmidt/httprouter" "html/template" + "log" "net/http" ) @@ -170,7 +171,8 @@ func (h *HttpServer) EditOtpPost(rw http.ResponseWriter, req *http.Request, _ ht } err := otp.Validate(req.FormValue("code")) if err != nil { - http.Error(rw, "400 Bad Request: invalid OTP code", http.StatusBadRequest) + http.Error(rw, "400 Bad Request: invalid OTP code: "+err.Error(), http.StatusBadRequest) + log.Println() return }