diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl
index e0a19a9743..3124048d36 100644
--- a/templates/user/auth/signin_inner.tmpl
+++ b/templates/user/auth/signin_inner.tmpl
@@ -48,10 +48,11 @@
{{end}}{{/*if .EnablePasswordSignInForm*/}}
- {{if and .OAuth2Providers .EnableOpenIDSignIn .EnablePasswordSignInForm}}
+ {{$showOAuth2Methods := or .OAuth2Providers .EnableOpenIDSignIn}}
+ {{if and $showOAuth2Methods .EnablePasswordSignInForm}}
{{ctx.Locale.Tr "sign_in_or"}}
{{end}}
- {{if and .OAuth2Providers .EnableOpenIDSignIn}}
+ {{if $showOAuth2Methods}}
{{template "user/auth/oauth_container" .}}
{{end}}
diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl
index 6969003968..41d0cd49b5 100644
--- a/templates/user/auth/signup_inner.tmpl
+++ b/templates/user/auth/signup_inner.tmpl
@@ -47,8 +47,8 @@
{{end}}
-
- {{if and .OAuth2Providers .EnableOpenIDSignIn}}
+ {{$showOAuth2Methods := or .OAuth2Providers .EnableOpenIDSignIn}}
+ {{if $showOAuth2Methods}}
{{ctx.Locale.Tr "sign_in_or"}}
{{template "user/auth/oauth_container" .}}
{{end}}