summaryrefslogtreecommitdiffstats
path: root/routers/admin
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-11-28 17:35:41 +0000
committertechknowlogick <techknowlogick@gitea.io>2019-11-28 12:35:41 -0500
commit54dab5aed999c1c3c0dd247de54a9cc2f9e6ebef (patch)
treedc9ccb097bb75a758cdfa01ba1714e3aac32893f /routers/admin
parent3bdce82ce97299beb542fd90f5cc21caad302e08 (diff)
downloadgitea-54dab5aed999c1c3c0dd247de54a9cc2f9e6ebef.tar.gz
gitea-54dab5aed999c1c3c0dd247de54a9cc2f9e6ebef.zip
Properly fix displaying virtual session provider in admin panel (#9137)
* Properly fix #7127 Although #7300 properly shadows the password from the virtual session provider, the template displaying the provider config still presumed that the config was JSON. This PR updates the template and properly hides the Virtual Session provider. Fixes #7127 * update per @silverwind's suggestion
Diffstat (limited to 'routers/admin')
-rw-r--r--routers/admin/admin.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go
index 4c4738ae8c..45bdbfe7f2 100644
--- a/routers/admin/admin.go
+++ b/routers/admin/admin.go
@@ -262,13 +262,7 @@ func shadowPassword(provider, cfgItem string) string {
return shadowURL(provider, cfgItem)
// postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
// Notice: use shadowURL
- case "VirtualSession":
- var realSession session.Options
- if err := json.Unmarshal([]byte(cfgItem), &realSession); err == nil {
- return shadowPassword(realSession.Provider, realSession.ProviderConfig)
- }
}
-
return cfgItem
}
@@ -314,8 +308,14 @@ func Config(ctx *context.Context) {
ctx.Data["CacheItemTTL"] = setting.CacheService.TTL
sessionCfg := setting.SessionConfig
+ if sessionCfg.Provider == "VirtualSession" {
+ var realSession session.Options
+ if err := json.Unmarshal([]byte(sessionCfg.ProviderConfig), &realSession); err != nil {
+ log.Error("Unable to unmarshall session config for virtualed provider config: %s\nError: %v", sessionCfg.ProviderConfig, err)
+ }
+ sessionCfg = realSession
+ }
sessionCfg.ProviderConfig = shadowPassword(sessionCfg.Provider, sessionCfg.ProviderConfig)
-
ctx.Data["SessionConfig"] = sessionCfg
ctx.Data["DisableGravatar"] = setting.DisableGravatar