summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/issue.go15
-rw-r--r--modules/auth/release.go15
-rw-r--r--modules/base/conf.go1
-rw-r--r--modules/middleware/auth.go5
4 files changed, 6 insertions, 30 deletions
diff --git a/modules/auth/issue.go b/modules/auth/issue.go
index 85be12d2b5..e8f8ac2011 100644
--- a/modules/auth/issue.go
+++ b/modules/auth/issue.go
@@ -11,7 +11,6 @@ import (
"github.com/go-martini/martini"
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware/binding"
)
@@ -31,20 +30,6 @@ func (f *CreateIssueForm) Name(field string) string {
}
func (f *CreateIssueForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) {
- if req.Method == "GET" || errors.Count() == 0 {
- return
- }
-
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
- data["HasError"] = true
- AssignForm(f, data)
-
- if len(errors.Overall) > 0 {
- for _, err := range errors.Overall {
- log.Error("CreateIssueForm.Validate: %v", err)
- }
- return
- }
-
validate(errors, data, f)
}
diff --git a/modules/auth/release.go b/modules/auth/release.go
index 9855c30338..7774b914a0 100644
--- a/modules/auth/release.go
+++ b/modules/auth/release.go
@@ -11,7 +11,6 @@ import (
"github.com/go-martini/martini"
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware/binding"
)
@@ -32,20 +31,6 @@ func (f *NewReleaseForm) Name(field string) string {
}
func (f *NewReleaseForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) {
- if req.Method == "GET" || errors.Count() == 0 {
- return
- }
-
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
- data["HasError"] = true
- AssignForm(f, data)
-
- if len(errors.Overall) > 0 {
- for _, err := range errors.Overall {
- log.Error("NewReleaseForm.Validate: %v", err)
- }
- return
- }
-
validate(errors, data, f)
}
diff --git a/modules/base/conf.go b/modules/base/conf.go
index cbd6532ba7..88085172c2 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -98,6 +98,7 @@ var Service struct {
LdapAuth bool
}
+// ExecDir returns absolute path execution(binary) path.
func ExecDir() (string, error) {
file, err := exec.LookPath(os.Args[0])
if err != nil {
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index cd00d4679e..e208fb017e 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -6,6 +6,7 @@ package middleware
import (
"net/url"
+ "strings"
"github.com/go-martini/martini"
@@ -40,6 +41,10 @@ func Toggle(options *ToggleOptions) martini.Handler {
if options.SignInRequire {
if !ctx.IsSigned {
+ // Ignore watch repository operation.
+ if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
+ return
+ }
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login")
return