Пример #1
0
func (c Admin) checkAdmin() bool {
	user := model.FindUserByName(c.Session["user_name"])
	if user.Email == "*****@*****.**" {
		return true
	} else {
		return false
	}
}
Пример #2
0
func (c Application) AddUser() revel.Result {
	if isLogin(c.Controller) {
		user := model.FindUserByName(c.Session["user_name"])
		c.RenderArgs["user"] = user
	}

	return nil
}
Пример #3
0
func CurrentUser(c *revel.Controller) (user *model.User) {
	if c.RenderArgs["user"] != nil {
		user = c.RenderArgs["user"].(*model.User)
		return
	}

	if isLogin(c) {
		user = model.FindUserByName(c.Session["user_name"])
		return
	}

	return nil
}
Пример #4
0
func (c Users) Show(username string) revel.Result {
	user := model.FindUserByName(username)
	avatar := user.AvatarUrl()

	return c.Render(user, avatar)
}