From 5ec77ecd724b8536d85c5a4e646ed532c6b68234 Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Sat, 10 Oct 2020 16:00:18 +0200 Subject: [PATCH] Fix username when authentication is disabled --- handler/session.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/handler/session.go b/handler/session.go index 5d3606a..6985327 100644 --- a/handler/session.go +++ b/handler/session.go @@ -27,6 +27,10 @@ func validSession(c echo.Context) { // currentUser to get username of logged in user func currentUser(c echo.Context) string { + if util.DisableLogin { + return "" + } + sess, _ := session.Get("session", c) username := fmt.Sprintf("%s", sess.Values["username"]) return username