mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-14 23:10:25 +00:00
The authentication provider's name (`$provider.DisplayName`) is not URL-encoded, so any illegal characters (e.g., '/') will be put in the link's href attribute verbatim. For example, if the provider's name is `foo/bar` (valid name), the href attribute will point to `/user/oauth2/foo/bar` instead of `/user/oauth2/foo%2Fbar`, resulting in a "404 Not found" error. This patch fixes this behaviour by URL-encoding the provider's DisplayName before appending it to the href attribute. Signed-off-by: doasu <me@doasu.dev> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10301 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: doasu <me@doasu.dev> Co-committed-by: doasu <me@doasu.dev>
25 lines
1.1 KiB
Go HTML Template
25 lines
1.1 KiB
Go HTML Template
{{if or .OAuth2Providers .EnableOpenIDSignIn}}
|
|
{{if or (and .PageIsSignUp (not .DisableRegistration)) (and .PageIsSignIn .EnableInternalSignIn)}}
|
|
<div class="divider divider-text">
|
|
{{ctx.Locale.Tr "sign_in_or"}}
|
|
</div>
|
|
{{end}}
|
|
<div id="oauth2-login-navigator" class="tw-py-1">
|
|
<div class="tw-flex tw-flex-col tw-justify-center">
|
|
<div id="oauth2-login-navigator-inner" class="tw-flex tw-flex-col tw-flex-wrap tw-items-center tw-gap-2">
|
|
{{range $provider := .OAuth2Providers}}
|
|
<a class="{{$provider.Name}} ui button tw-flex tw-items-center tw-justify-center tw-py-2 tw-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName | PathEscape}}">
|
|
{{$provider.IconHTML 28}}
|
|
{{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
|
</a>
|
|
{{end}}
|
|
{{if .EnableOpenIDSignIn}}
|
|
<a class="openid ui button tw-flex tw-items-center tw-justify-center tw-py-2 tw-w-full" href="{{AppSubUrl}}/user/login/openid">
|
|
{{svg "fontawesome-openid" 28 "tw-mr-2"}}
|
|
{{ctx.Locale.Tr "auth.sign_in_openid"}}
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|