Fix username when authentication is disabled
This commit is contained in:
		
							parent
							
								
									954c54cbd9
								
							
						
					
					
						commit
						5ec77ecd72
					
				|  | @ -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 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue