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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ var groupRight = map[string]int{
|
||||
"admin": 4,
|
||||
}
|
||||
|
||||
func emptyUser() *User {
|
||||
func EmptyUser() *User {
|
||||
return &User{
|
||||
Name: "anon",
|
||||
Group: "anon",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user