From 19195a4c777d38225c68c4a3c4e253b4e5e770ff Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 21 Mar 2025 19:10:42 +0800 Subject: [PATCH] fix --- routers/web/auth/oauth2_provider.go | 2 +- templates/user/auth/grant.tmpl | 60 ++++++++++++++-------------- templates/user/auth/grant_error.tmpl | 19 ++++----- 3 files changed, 38 insertions(+), 43 deletions(-) diff --git a/routers/web/auth/oauth2_provider.go b/routers/web/auth/oauth2_provider.go index 00b5b2db52d5d..ff571fbf2c10a 100644 --- a/routers/web/auth/oauth2_provider.go +++ b/routers/web/auth/oauth2_provider.go @@ -249,7 +249,7 @@ func AuthorizeOAuth(ctx *context.Context) { }, form.RedirectURI) return } - if err := ctx.Session.Set("CodeChallengeMethod", form.CodeChallenge); err != nil { + if err := ctx.Session.Set("CodeChallenge", form.CodeChallenge); err != nil { handleAuthorizeError(ctx, AuthorizeError{ ErrorCode: ErrorCodeServerError, ErrorDescription: "cannot set code challenge", diff --git a/templates/user/auth/grant.tmpl b/templates/user/auth/grant.tmpl index 7a6f156e36fe6..e56241b0f8af4 100644 --- a/templates/user/auth/grant.tmpl +++ b/templates/user/auth/grant.tmpl @@ -1,35 +1,33 @@ {{template "base/head" .}} -
-
-
-

- {{ctx.Locale.Tr "auth.authorize_title" .Application.Name}} -

-
- {{template "base/alert" .}} -

- {{if not .AdditionalScopes}} - {{ctx.Locale.Tr "auth.authorize_application_description"}}
- {{end}} - {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML}}
- {{ctx.Locale.Tr "auth.authorize_application_with_scopes" (HTMLFormat "%s" .Scope)}} -

-
-
-

{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML}}

-
-
-
- {{.CsrfTokenHtml}} - - - - - - - -
-
+
+
+

+ {{ctx.Locale.Tr "auth.authorize_title" .Application.Name}} +

+
+ {{template "base/alert" .}} +

+ {{if not .AdditionalScopes}} + {{ctx.Locale.Tr "auth.authorize_application_description"}}
+ {{end}} + {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML}}
+ {{ctx.Locale.Tr "auth.authorize_application_with_scopes" (HTMLFormat "%s" .Scope)}} +

+
+
+

{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML}}

+
+
+
+ {{.CsrfTokenHtml}} + + + + + + + +
diff --git a/templates/user/auth/grant_error.tmpl b/templates/user/auth/grant_error.tmpl index e37c4f65441fd..7a4521d3314d9 100644 --- a/templates/user/auth/grant_error.tmpl +++ b/templates/user/auth/grant_error.tmpl @@ -1,15 +1,12 @@ {{template "base/head" .}} -
- {{if .IsRepo}}{{template "repo/header" .}}{{end}} -
-
-

- {{ctx.Locale.Tr "auth.authorization_failed"}} -

-

{{.Error.ErrorDescription}}

-
-

{{ctx.Locale.Tr "auth.authorization_failed_desc"}}

-
+
+
+

+ {{ctx.Locale.Tr "auth.authorization_failed"}} +

+

{{.Error.ErrorDescription}}

+
+

{{ctx.Locale.Tr "auth.authorization_failed_desc"}}