diff --git a/templates/user/auth/oauth_container.tmpl b/templates/user/auth/oauth_container.tmpl
index ecae2bbbf3..c20273be14 100644
--- a/templates/user/auth/oauth_container.tmpl
+++ b/templates/user/auth/oauth_container.tmpl
@@ -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">
diff --git a/tests/integration/signin_test.go b/tests/integration/signin_test.go
index c986b844f0..f8e2e079ca 100644
--- a/tests/integration/signin_test.go
+++ b/tests/integration/signin_test.go
@@ -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) {
diff --git a/tests/integration/signup_test.go b/tests/integration/signup_test.go
index d5df41fabf..39533bbf89 100644
--- a/tests/integration/signup_test.go
+++ b/tests/integration/signup_test.go
@@ -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)
+		})
+	})
+}