示例#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)
}