From 4df2320ba6a9a36a879d1331bc4f87f95858e170 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 13 Mar 2022 02:42:31 +0000 Subject: [PATCH] Prevent 500 when there is an error during new auth source post (#19041) (#19059) Backport #19041 Fix #19036 Signed-off-by: Andrew Thornton --- routers/web/admin/auths.go | 4 ++-- templates/admin/auth/new.tmpl | 2 +- templates/admin/auth/source/oauth.tmpl | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/routers/web/admin/auths.go b/routers/web/admin/auths.go index 20f364739e..a15efb6906 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) } diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl index b8e80dbcaa..9882cde03b 100644 --- a/templates/admin/auth/new.tmpl +++ b/templates/admin/auth/new.tmpl @@ -14,7 +14,7 @@