1
0
Fork 0
forked from forgejo/forgejo

Support reverse proxy providing email (#5554)

This PR implements #2347
This commit is contained in:
zeripath 2018-12-18 17:05:48 +00:00 committed by techknowlogick
parent fe55ab2a68
commit 2a660a1de1
5 changed files with 28 additions and 10 deletions

View file

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