Respond with OTP error message

This commit is contained in:
Melon 2023-10-16 15:00:33 +01:00
parent f9ed40b8e5
commit 9fccb563e1
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -9,6 +9,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
"html/template" "html/template"
"log"
"net/http" "net/http"
) )
@ -170,7 +171,8 @@ func (h *HttpServer) EditOtpPost(rw http.ResponseWriter, req *http.Request, _ ht
} }
err := otp.Validate(req.FormValue("code")) err := otp.Validate(req.FormValue("code"))
if err != nil { 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 return
} }