Improve delete SSH key

This commit is contained in:
Unknown 2014-05-06 16:28:52 -04:00
parent 7cb5a15c9b
commit 8ca14e2109
14 changed files with 49 additions and 101 deletions

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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 {

View file

@ -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