mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-10 15:42:16 +01:00
fix(ui): show oauth divider on signup page (#6463)
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
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>
This commit is contained in:
parent
959c902748
commit
339814f3bc
3 changed files with 36 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
|||
{{if or .OAuth2Providers .EnableOpenIDSignIn}}
|
||||
{{if .EnableInternalSignIn}}
|
||||
<div class="divider divider-text">
|
||||
{{ctx.Locale.Tr "sign_in_or"}}
|
||||
</div>
|
||||
{{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">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
@ -97,6 +98,9 @@ func TestSigninWithRememberMe(t *testing.T) {
|
|||
|
||||
func TestDisableSignin(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
// Mock alternative auth ways as enabled
|
||||
defer test.MockVariableValue(&setting.Service.EnableOpenIDSignIn, true)()
|
||||
defer test.MockVariableValue(&setting.Service.EnableOpenIDSignUp, true)()
|
||||
t.Run("Disabled", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, false)()
|
||||
|
||||
|
@ -107,6 +111,7 @@ func TestDisableSignin(t *testing.T) {
|
|||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "form[action='/user/login']", false)
|
||||
htmlDoc.AssertElement(t, ".divider-text", false)
|
||||
})
|
||||
|
||||
t.Run("Signin", func(t *testing.T) {
|
||||
|
@ -126,6 +131,7 @@ func TestDisableSignin(t *testing.T) {
|
|||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "form[action='/user/login']", true)
|
||||
htmlDoc.AssertElement(t, ".divider-text", true)
|
||||
})
|
||||
|
||||
t.Run("Signin", func(t *testing.T) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
@ -207,3 +208,28 @@ func TestSignupImageCaptcha(t *testing.T) {
|
|||
|
||||
unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "captcha-test", IsActive: true})
|
||||
}
|
||||
|
||||
func TestSignupFormUI(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
t.Run("UI", func(t *testing.T) {
|
||||
// Mock alternative auth ways as enabled
|
||||
defer test.MockVariableValue(&setting.Service.EnableOpenIDSignIn, true)()
|
||||
defer test.MockVariableValue(&setting.Service.EnableOpenIDSignUp, true)()
|
||||
t.Run("Internal registration enabled", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.Service.AllowOnlyExternalRegistration, false)()
|
||||
req := NewRequest(t, "GET", "/user/sign_up")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "form[action='/user/sign_up'] input#user_name", true)
|
||||
htmlDoc.AssertElement(t, ".divider-text", true)
|
||||
})
|
||||
t.Run("Internal registration disabled", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.Service.AllowOnlyExternalRegistration, true)()
|
||||
req := NewRequest(t, "GET", "/user/sign_up")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "form[action='/user/sign_up'] input#user_name", false)
|
||||
htmlDoc.AssertElement(t, ".divider-text", false)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue