Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oauth2 auth and UI #33961

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion routers/web/auth/oauth2_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 3 additions & 5 deletions templates/user/auth/grant.tmpl
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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}}">
Expand All @@ -32,5 +31,4 @@
</div>
</div>
</div>
</div>
{{template "base/footer" .}}
7 changes: 2 additions & 5 deletions templates/user/auth/grant_error.tmpl
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -12,5 +10,4 @@
</div>
</div>
</div>
</div>
{{template "base/footer" .}}