diff options
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/auth.go | 6 | ||||
-rw-r--r-- | modules/auth/pam/pam.go | 2 | ||||
-rw-r--r-- | modules/auth/pam/pam_stub.go | 2 | ||||
-rw-r--r-- | modules/auth/user_form.go | 12 |
4 files changed, 13 insertions, 9 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index edcb1306..42346430 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -21,6 +21,10 @@ import ( "github.com/gogits/gogs/modules/uuid" ) +func IsAPIPath(url string) bool { + return strings.HasPrefix(url, "/api/") +} + // SignedInId returns the id of signed in user. func SignedInId(req *http.Request, sess session.Store) int64 { if !models.HasEngine { @@ -28,7 +32,7 @@ func SignedInId(req *http.Request, sess session.Store) int64 { } // API calls need to check access token. - if strings.HasPrefix(req.URL.Path, "/api/") { + if IsAPIPath(req.URL.Path) { auHead := req.Header.Get("Authorization") if len(auHead) > 0 { auths := strings.Fields(auHead) diff --git a/modules/auth/pam/pam.go b/modules/auth/pam/pam.go index 7d150b1c..7f326d42 100644 --- a/modules/auth/pam/pam.go +++ b/modules/auth/pam/pam.go @@ -1,4 +1,4 @@ -// +build !windows +// +build pam // Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style diff --git a/modules/auth/pam/pam_stub.go b/modules/auth/pam/pam_stub.go index 2f210bf6..33ac751a 100644 --- a/modules/auth/pam/pam_stub.go +++ b/modules/auth/pam/pam_stub.go @@ -1,4 +1,4 @@ -// +build windows +// +build !pam // Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index b7c502ef..fa5583ff 100644 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -17,20 +17,20 @@ type InstallForm struct { DbUser string DbPasswd string DbName string - SSLMode string `form:"ssl_mode"` + SSLMode string DbPath string AppName string `binding:"Required" locale:"install.app_name"` RepoRootPath string `binding:"Required"` RunUser string `binding:"Required"` Domain string `binding:"Required"` - HTTPPort string `form:"http_port" binding:"Required"` + HTTPPort string `binding:"Required"` AppUrl string `binding:"Required"` - SMTPHost string `form:"smtp_host"` - SMTPFrom string `form:"smtp_from"` - SMTPEmail string `form:"smtp_user" binding:"OmitEmpty;Email;MaxSize(50)" locale:"install.mailer_user"` - SMTPPasswd string `form:"smtp_passwd"` + SMTPHost string + SMTPFrom string + SMTPEmail string `binding:"OmitEmpty;Email;MaxSize(50)" locale:"install.mailer_user"` + SMTPPasswd string RegisterConfirm bool MailNotify bool |