diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-04-10 14:38:48 -0400 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-04-10 14:38:48 -0400 |
commit | 8faa0dbcd77ec17bbf88041f46e2fc48f6ca6f31 (patch) | |
tree | 3dff34e53f34632532fd7a05e00e6f06b3e7fb82 /web.go | |
parent | 2577940c30f6a6d15390974ab36f8c3d1e00f9f4 (diff) | |
parent | a4cbe79567072befd96cf1b7eb319de1e2809ca3 (diff) |
Merge pull request #70 from zhsso/git
Git
Diffstat (limited to 'web.go')
-rw-r--r-- | web.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -11,10 +11,10 @@ import ( "github.com/codegangsta/cli" "github.com/go-martini/martini" + qlog "github.com/qiniu/log" "github.com/gogits/binding" - "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/base" @@ -72,6 +72,11 @@ func runWeb(*cli.Context) { reqSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true}) ignSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: base.Service.RequireSignInView}) + ignSignInAndCsrf := middleware.Toggle(&middleware.ToggleOptions{ + SignInRequire: base.Service.RequireSignInView, + DisableCsrf: true, + }) + reqSignOut := middleware.Toggle(&middleware.ToggleOptions{SignOutRequire: true}) // Routers. @@ -91,7 +96,7 @@ func runWeb(*cli.Context) { m.Group("/user", func(r martini.Router) { r.Any("/login", binding.BindIgnErr(auth.LogInForm{}), user.SignIn) - r.Any("/login/github", oauth2.LoginRequired, user.SocialSignIn) + r.Any("/login/github", user.SocialSignIn) r.Any("/sign_up", binding.BindIgnErr(auth.RegisterForm{}), user.SignUp) r.Any("/forget_password", user.ForgotPasswd) r.Any("/reset_password", user.ResetPasswd) @@ -116,6 +121,7 @@ func runWeb(*cli.Context) { m.Get("/user/:username", ignSignIn, user.Profile) m.Any("/repo/create", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create) + m.Any("/repo/mirror", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Mirror) adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true}) @@ -165,7 +171,7 @@ func runWeb(*cli.Context) { m.Group("/:username", func(r martini.Router) { r.Any("/:reponame/**", repo.Http) r.Get("/:reponame", middleware.RepoAssignment(true, true, true), repo.Single) - }, ignSignIn) + }, ignSignInAndCsrf) // Not found handler. m.NotFound(routers.NotFound) |