// Copyright 2014 The Gogs Authors. All rights reserved.// Use of this source code is governed by a MIT-style// license that can be found in the LICENSE file.packagemiddlewareimport("github.com/codegangsta/martini")// SignInRequire requires user to sign in.funcSignInRequire(redirectbool)martini.Handler{returnfunc(ctx*Context){if!ctx.IsSigned{ifredirect{ctx.Render.Redirect("/")}return}}}// SignOutRequire requires user to sign out.funcSignOutRequire()martini.Handler{returnfunc(ctx*Context){ifctx.IsSigned{ctx.Render.Redirect("/")}}}