1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-04 15:48:05 +00:00

Move the user link to the header links

This commit is contained in:
bouncepaw
2021-01-24 12:30:14 +05:00
parent 455a3e0f79
commit e33e5d06a1
14 changed files with 239 additions and 219 deletions

View File

@@ -17,7 +17,7 @@ func CanProceed(rq *http.Request, route string) bool {
func FromRequest(rq *http.Request) *User {
cookie, err := rq.Cookie("mycorrhiza_token")
if err != nil {
return emptyUser()
return EmptyUser()
}
return userByToken(cookie.Value)
}

View File

@@ -37,7 +37,7 @@ var groupRight = map[string]int{
"admin": 4,
}
func emptyUser() *User {
func EmptyUser() *User {
return &User{
Name: "anon",
Group: "anon",

View File

@@ -44,7 +44,7 @@ func userByToken(token string) *User {
username := usernameUntyped.(string)
return userByName(username)
}
return emptyUser()
return EmptyUser()
}
func userByName(username string) *User {
@@ -52,7 +52,7 @@ func userByName(username string) *User {
user := userUntyped.(*User)
return user
}
return emptyUser()
return EmptyUser()
}
func commenceSession(username, token string) {