diff options
author | zeripath <art27@cantab.net> | 2022-03-10 22:40:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 23:40:43 +0100 |
commit | a223bc8765f18e1efc59d5291412d0076dfeaa9b (patch) | |
tree | 119ac7416597442fdc5a22eafbbdd788894dde4b /routers | |
parent | 886b1de94914186a502ed68a6a281a15f1d8d9a3 (diff) | |
download | gitea-a223bc8765f18e1efc59d5291412d0076dfeaa9b.tar.gz gitea-a223bc8765f18e1efc59d5291412d0076dfeaa9b.zip |
Prevent 500 when there is an error during new auth source post (#19041)
Fix #19036
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/admin/auths.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/routers/web/admin/auths.go b/routers/web/admin/auths.go index a8e0cd37b6..4c77a169ae 100644 --- a/routers/web/admin/auths.go +++ b/routers/web/admin/auths.go @@ -93,7 +93,7 @@ func NewAuthSource(ctx *context.Context) { ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true - ctx.Data["type"] = auth.LDAP + ctx.Data["type"] = auth.LDAP.Int() ctx.Data["CurrentTypeName"] = auth.Names[auth.LDAP] ctx.Data["CurrentSecurityProtocol"] = ldap.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted] ctx.Data["smtp_auth"] = "PLAIN" @@ -112,7 +112,7 @@ func NewAuthSource(ctx *context.Context) { ctx.Data["SSPIDefaultLanguage"] = "" // only the first as default - ctx.Data["oauth2_provider"] = oauth2providers[0] + ctx.Data["oauth2_provider"] = oauth2providers[0].Name ctx.HTML(http.StatusOK, tplAuthNew) } @@ -253,9 +253,6 @@ func NewAuthSourcePost(ctx *context.Context) { ctx.Data["SSPISeparatorReplacement"] = "_" ctx.Data["SSPIDefaultLanguage"] = "" - // FIXME: most error path to render tplAuthNew will fail and result in 500 - // * template: admin/auth/new:17:68: executing "admin/auth/new" at <.type.Int>: can't evaluate field Int in type interface {} - // * template: admin/auth/source/oauth:5:93: executing "admin/auth/source/oauth" at <.oauth2_provider.Name>: can't evaluate field Name in type interface {} hasTLS := false var config convert.Conversion switch auth.Type(form.Type) { |