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
No known key found for this signature in database
GPG Key ID: 29077342AA5648F6
1 changed files with 4 additions and 0 deletions

View File

@ -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