// 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.Redirect("/")}return}elseif!ctx.User.IsActive{// ctx.Data["Title"] = "Activate Your Account"// ctx.Render.HTML(200, "user/active", ctx.Data)// return}}}// SignOutRequire requires user to sign out.funcSignOutRequire()martini.Handler{returnfunc(ctx*Context){ifctx.IsSigned{ctx.Redirect("/")}}}