From 5e3776ddbc08cd328e27b00864c901073fb0dc9d Mon Sep 17 00:00:00 2001 From: Nya Candy Date: Wed, 25 Jan 2023 00:40:27 +0800 Subject: [PATCH] :art: --- handlers/consent/consent_check.go | 15 ++++++++++++--- templates/consent.tmpl | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/handlers/consent/consent_check.go b/handlers/consent/consent_check.go index bb8d86c..8604419 100644 --- a/handlers/consent/consent_check.go +++ b/handlers/consent/consent_check.go @@ -93,12 +93,21 @@ func ConsentCheck(ctx *gin.Context) { // Show the consent UI global.Logger.Debugf("Rendering consent UI...") - ctx.HTML(http.StatusOK, "consent.tmpl", gin.H{ - "client": consentReq.Client, + templateFields := gin.H{ "user": acceptCtx.User, "challenge": oauth2challenge, "csrf": csrf, - }) + } + + if consentReq.Client.LogoUri != nil && *consentReq.Client.LogoUri != "" { + templateFields["logo"] = *consentReq.Client.LogoUri + } + if consentReq.Client.ClientName != nil && *consentReq.Client.ClientName != "" { + templateFields["clientName"] = *consentReq.Client.ClientName + } else { + templateFields["clientName"] = *consentReq.Client.ClientId + } + ctx.HTML(http.StatusOK, "consent.tmpl", templateFields) global.Logger.Debugf("User should now see Consent UI.") } diff --git a/templates/consent.tmpl b/templates/consent.tmpl index 5577c1c..6e6c878 100644 --- a/templates/consent.tmpl +++ b/templates/consent.tmpl @@ -4,6 +4,9 @@ 授权确认 {{ template "head.tmpl" }}