summaryrefslogtreecommitdiffstats
path: root/modules/auth
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-03-15 19:01:50 +0800
committerslene <vslene@gmail.com>2014-03-15 19:01:50 +0800
commitfa5ad1e46560bd006bccf57e5cac39589d18e344 (patch)
tree6157a0fb7f2333207d8ba907713be873b3eb0e52 /modules/auth
parent06deed820d9f48ecf972c8716b17ad58b91ab9b9 (diff)
downloadgitea-fa5ad1e46560bd006bccf57e5cac39589d18e344.tar.gz
gitea-fa5ad1e46560bd006bccf57e5cac39589d18e344.zip
move templateFuncs to one file, add middleware context.
Diffstat (limited to 'modules/auth')
-rw-r--r--modules/auth/user.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/modules/auth/user.go b/modules/auth/user.go
index d950b25002..9c9ce686df 100644
--- a/modules/auth/user.go
+++ b/modules/auth/user.go
@@ -9,7 +9,6 @@ import (
"reflect"
"github.com/codegangsta/martini"
- "github.com/martini-contrib/render"
"github.com/martini-contrib/sessions"
"github.com/gogits/binding"
@@ -62,39 +61,6 @@ func IsSignedIn(session sessions.Session) bool {
return SignedInId(session) > 0
}
-// SignInRequire checks user status from session.
-// It will assign correspoding values to
-// template data map if user has signed in.
-func SignInRequire(redirect bool) martini.Handler {
- return func(r render.Render, data base.TmplData, session sessions.Session) {
- if !IsSignedIn(session) {
- if redirect {
- r.Redirect("/")
- }
- return
- }
-
- user := SignedInUser(session)
- if user == nil {
- r.Redirect("/")
- return
- }
-
- data["IsSigned"] = true
- data["SignedUser"] = user
- data["SignedUserId"] = user.Id
- data["SignedUserName"] = user.LowerName
- }
-}
-
-func SignOutRequire() martini.Handler {
- return func(r render.Render, session sessions.Session) {
- if IsSignedIn(session) {
- r.Redirect("/")
- }
- }
-}
-
type FeedsForm struct {
UserId int64 `form:"userid" binding:"Required"`
Offset int64 `form:"offset"`