Fix oauth2 auth and UI (#33961)

This commit is contained in:
wxiaoguang 2025-03-21 20:50:39 +08:00 committed by GitHub
parent 0da7318cf3
commit 279473f467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 43 deletions

View File

@ -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",

View File

@ -1,7 +1,6 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content ui one column stackable tw-text-center page grid oauth2-authorize-application-box">
<div class="column seven wide">
<div class="ui middle centered raised segments">
<div role="main" aria-label="{{.Title}}" class="page-content oauth2-authorize-application-box">
<div class="ui container tw-max-w-[500px]">
<h3 class="ui top attached header">
{{ctx.Locale.Tr "auth.authorize_title" .Application.Name}}
</h3>
@ -18,7 +17,7 @@
<div class="ui attached segment">
<p>{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML}}</p>
</div>
<div class="ui attached segment">
<div class="ui attached segment tw-text-center">
<form method="post" action="{{AppSubUrl}}/login/oauth/grant">
{{.CsrfTokenHtml}}
<input type="hidden" name="client_id" value="{{.Application.ClientID}}">
@ -31,6 +30,5 @@
</form>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}

View File

@ -1,8 +1,6 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content ui one column stackable tw-text-center page grid oauth2-authorize-application-box {{if .IsRepo}}repository{{end}}">
{{if .IsRepo}}{{template "repo/header" .}}{{end}}
<div class="column seven wide">
<div class="ui middle centered raised segments">
<div role="main" aria-label="{{.Title}}" class="page-content oauth2-authorize-application-box">
<div class="ui container tw-max-w-[500px]">
<h1 class="ui top attached header">
{{ctx.Locale.Tr "auth.authorization_failed"}}
</h1>
@ -11,6 +9,5 @@
<p>{{ctx.Locale.Tr "auth.authorization_failed_desc"}}</p>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}