Fix username when authentication is disabled

This commit is contained in:
Khanh Ngo
2020-10-10 16:00:18 +02:00
parent 954c54cbd9
commit 5ec77ecd72

View File

@@ -27,6 +27,10 @@ func validSession(c echo.Context) {
// currentUser to get username of logged in user // currentUser to get username of logged in user
func currentUser(c echo.Context) string { func currentUser(c echo.Context) string {
if util.DisableLogin {
return ""
}
sess, _ := session.Get("session", c) sess, _ := session.Get("session", c)
username := fmt.Sprintf("%s", sess.Values["username"]) username := fmt.Sprintf("%s", sess.Values["username"])
return username return username