fix #165
parent
298ebc58c1
commit
069486d169
|
@ -77,6 +77,7 @@ ENABLE_CACHE_AVATAR = false
|
||||||
ENABLE_NOTIFY_MAIL = false
|
ENABLE_NOTIFY_MAIL = false
|
||||||
; More detail: https://github.com/gogits/gogs/issues/165
|
; More detail: https://github.com/gogits/gogs/issues/165
|
||||||
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
||||||
|
ENABLE_REVERSE_PROXY_AUTO_REGISTERATION = false
|
||||||
|
|
||||||
[webhook]
|
[webhook]
|
||||||
; Cron task interval in minutes
|
; Cron task interval in minutes
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.5.8.1130 Beta"
|
const APP_VER = "0.5.8.1205 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -60,6 +60,7 @@ func SignedInId(req *http.Request, sess session.Store) int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignedInUser returns the user object of signed user.
|
// SignedInUser returns the user object of signed user.
|
||||||
|
// It returns a bool value to indicate whether user uses basic auth or not.
|
||||||
func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) {
|
func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) {
|
||||||
if !models.HasEngine {
|
if !models.HasEngine {
|
||||||
return nil, false
|
return nil, false
|
||||||
|
@ -75,8 +76,25 @@ func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != models.ErrUserNotExist {
|
if err != models.ErrUserNotExist {
|
||||||
log.Error(4, "GetUserByName: %v", err)
|
log.Error(4, "GetUserByName: %v", err)
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if enabled auto-registeration.
|
||||||
|
if setting.Service.EnableReverseProxyAutoRegister {
|
||||||
|
u := &models.User{
|
||||||
|
Name: webAuthUser,
|
||||||
|
Email: webAuthUser + "@gogs.io",
|
||||||
|
Passwd: webAuthUser,
|
||||||
|
IsActive: true,
|
||||||
|
}
|
||||||
|
if err = models.CreateUser(u); err != nil {
|
||||||
|
// FIXME: should I create a system notice?
|
||||||
|
log.Error(4, "CreateUser: %v", err)
|
||||||
|
return nil, false
|
||||||
|
} else {
|
||||||
|
return u, false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, false
|
|
||||||
}
|
}
|
||||||
return u, false
|
return u, false
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,15 +300,15 @@ func NewConfigContext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var Service struct {
|
var Service struct {
|
||||||
RegisterEmailConfirm bool
|
RegisterEmailConfirm bool
|
||||||
DisableRegistration bool
|
DisableRegistration bool
|
||||||
RequireSignInView bool
|
RequireSignInView bool
|
||||||
EnableCacheAvatar bool
|
EnableCacheAvatar bool
|
||||||
EnableNotifyMail bool
|
EnableNotifyMail bool
|
||||||
EnableReverseProxyAuth bool
|
EnableReverseProxyAuth bool
|
||||||
LdapAuth bool
|
EnableReverseProxyAutoRegister bool
|
||||||
ActiveCodeLives int
|
ActiveCodeLives int
|
||||||
ResetPwdCodeLives int
|
ResetPwdCodeLives int
|
||||||
}
|
}
|
||||||
|
|
||||||
func newService() {
|
func newService() {
|
||||||
|
@ -318,6 +318,7 @@ func newService() {
|
||||||
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW")
|
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW")
|
||||||
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR")
|
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR")
|
||||||
Service.EnableReverseProxyAuth = Cfg.MustBool("service", "ENABLE_REVERSE_PROXY_AUTHENTICATION")
|
Service.EnableReverseProxyAuth = Cfg.MustBool("service", "ENABLE_REVERSE_PROXY_AUTHENTICATION")
|
||||||
|
Service.EnableReverseProxyAutoRegister = Cfg.MustBool("service", "ENABLE_REVERSE_PROXY_AUTO_REGISTERATION")
|
||||||
}
|
}
|
||||||
|
|
||||||
var logLevels = map[string]string{
|
var logLevels = map[string]string{
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.5.8.1130 Beta
|
0.5.8.1205 Beta
|
Loading…
Reference in New Issue