From f2a5d1b42b74498b35c4a7ac450ff32760d02f77 Mon Sep 17 00:00:00 2001
From: Viktor Kuzmin <kvaster@gmail.com>
Date: Mon, 11 Oct 2021 20:23:59 +0400
Subject: [PATCH] AutoRegistration is supposed to be working with disabled
 registration (#17219)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
---
 routers/web/user/auth.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/routers/web/user/auth.go b/routers/web/user/auth.go
index 12328e46a1..65515402cf 100644
--- a/routers/web/user/auth.go
+++ b/routers/web/user/auth.go
@@ -628,7 +628,7 @@ func SignInOAuthCallback(ctx *context.Context) {
 	}
 
 	if u == nil {
-		if !(setting.Service.DisableRegistration || setting.Service.AllowOnlyInternalRegistration) && setting.OAuth2Client.EnableAutoRegistration {
+		if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
 			// create new user with details from oauth2 provider
 			var missingFields []string
 			if gothUser.UserID == "" {