loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ui): show oauth divider on signup page (#6463)

Fix a minor UI bug introduced in https://codeberg.org/forgejo/forgejo/pulls/6112.

The condition `if .EnableInternalSignIn` was added to display of the divider, but it is only available when `oauth_container.tmpl` is called from signIn page, it is not relevant to signUp page.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6463
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

0ko 339814f3 959c9027

+36 -4
+4 -4
templates/user/auth/oauth_container.tmpl
··· 1 1 {{if or .OAuth2Providers .EnableOpenIDSignIn}} 2 - {{if .EnableInternalSignIn}} 3 - <div class="divider divider-text"> 4 - {{ctx.Locale.Tr "sign_in_or"}} 5 - </div> 2 + {{if or (and .PageIsSignUp (not .DisableRegistration)) (and .PageIsSignIn .EnableInternalSignIn)}} 3 + <div class="divider divider-text"> 4 + {{ctx.Locale.Tr "sign_in_or"}} 5 + </div> 6 6 {{end}} 7 7 <div id="oauth2-login-navigator" class="tw-py-1"> 8 8 <div class="tw-flex tw-flex-col tw-justify-center">
+6
tests/integration/signin_test.go
··· 1 1 // Copyright 2017 The Gitea Authors. All rights reserved. 2 + // Copyright 2024 The Forgejo Authors. All rights reserved. 2 3 // SPDX-License-Identifier: MIT 3 4 4 5 package integration ··· 97 98 98 99 func TestDisableSignin(t *testing.T) { 99 100 defer tests.PrepareTestEnv(t)() 101 + // Mock alternative auth ways as enabled 102 + defer test.MockVariableValue(&setting.Service.EnableOpenIDSignIn, true)() 103 + defer test.MockVariableValue(&setting.Service.EnableOpenIDSignUp, true)() 100 104 t.Run("Disabled", func(t *testing.T) { 101 105 defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, false)() 102 106 ··· 107 111 resp := MakeRequest(t, req, http.StatusOK) 108 112 htmlDoc := NewHTMLParser(t, resp.Body) 109 113 htmlDoc.AssertElement(t, "form[action='/user/login']", false) 114 + htmlDoc.AssertElement(t, ".divider-text", false) 110 115 }) 111 116 112 117 t.Run("Signin", func(t *testing.T) { ··· 126 131 resp := MakeRequest(t, req, http.StatusOK) 127 132 htmlDoc := NewHTMLParser(t, resp.Body) 128 133 htmlDoc.AssertElement(t, "form[action='/user/login']", true) 134 + htmlDoc.AssertElement(t, ".divider-text", true) 129 135 }) 130 136 131 137 t.Run("Signin", func(t *testing.T) {
+26
tests/integration/signup_test.go
··· 1 1 // Copyright 2017 The Gitea Authors. All rights reserved. 2 + // Copyright 2025 The Forgejo Authors. All rights reserved. 2 3 // SPDX-License-Identifier: MIT 3 4 4 5 package integration ··· 207 208 208 209 unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "captcha-test", IsActive: true}) 209 210 } 211 + 212 + func TestSignupFormUI(t *testing.T) { 213 + defer tests.PrepareTestEnv(t)() 214 + t.Run("UI", func(t *testing.T) { 215 + // Mock alternative auth ways as enabled 216 + defer test.MockVariableValue(&setting.Service.EnableOpenIDSignIn, true)() 217 + defer test.MockVariableValue(&setting.Service.EnableOpenIDSignUp, true)() 218 + t.Run("Internal registration enabled", func(t *testing.T) { 219 + defer test.MockVariableValue(&setting.Service.AllowOnlyExternalRegistration, false)() 220 + req := NewRequest(t, "GET", "/user/sign_up") 221 + resp := MakeRequest(t, req, http.StatusOK) 222 + htmlDoc := NewHTMLParser(t, resp.Body) 223 + htmlDoc.AssertElement(t, "form[action='/user/sign_up'] input#user_name", true) 224 + htmlDoc.AssertElement(t, ".divider-text", true) 225 + }) 226 + t.Run("Internal registration disabled", func(t *testing.T) { 227 + defer test.MockVariableValue(&setting.Service.AllowOnlyExternalRegistration, true)() 228 + req := NewRequest(t, "GET", "/user/sign_up") 229 + resp := MakeRequest(t, req, http.StatusOK) 230 + htmlDoc := NewHTMLParser(t, resp.Body) 231 + htmlDoc.AssertElement(t, "form[action='/user/sign_up'] input#user_name", false) 232 + htmlDoc.AssertElement(t, ".divider-text", false) 233 + }) 234 + }) 235 + }