Exemplo n.º 1
0
func (ah *AuthHandler) Get(ctx web.Context) (bool, error) {
	logger.Infof("scene ID: %s", ctx.Scene().ID())
	password, err := ctx.Scene().Fetch("password")
	if err == nil {
		logger.Infof("scene is logged in")
		return true, nil
	}
	password = ctx.Request().Header.Get("password")
	if password != ah.password {
		ctx.Redirect("authentication", "login", "")
		return false, nil
	}
	logger.Infof("logging scene in")
	ctx.Scene().Store("password", password)
	return true, nil
}