diff options
author | zeripath <art27@cantab.net> | 2018-12-18 17:05:48 +0000 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-12-18 12:05:48 -0500 |
commit | 2a660a1de17daf58b8f7d58dea4b82b107b47536 (patch) | |
tree | c25a824142ce6bfa0da191b7c711b7665807ae88 /modules/auth/auth.go | |
parent | fe55ab2a6806b6a7c114378c0436bc59a31646d0 (diff) | |
download | gitea-2a660a1de17daf58b8f7d58dea4b82b107b47536.tar.gz gitea-2a660a1de17daf58b8f7d58dea4b82b107b47536.zip |
Support reverse proxy providing email (#5554)
This PR implements #2347
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r-- | modules/auth/auth.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 0d703084da..4b0d4559c9 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -105,9 +105,16 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool) // Check if enabled auto-registration. if setting.Service.EnableReverseProxyAutoRegister { + email := gouuid.NewV4().String() + "@localhost" + if setting.Service.EnableReverseProxyEmail { + webAuthEmail := ctx.Req.Header.Get(setting.ReverseProxyAuthEmail) + if len(webAuthEmail) > 0 { + email = webAuthEmail + } + } u := &models.User{ Name: webAuthUser, - Email: gouuid.NewV4().String() + "@localhost", + Email: email, Passwd: webAuthUser, IsActive: true, } |