mirror of
				https://github.com/Tivix/django-rest-auth.git
				synced 2025-11-04 01:27:36 +03:00 
			
		
		
		
	Merge 499bf72615 into cdd04aa9be
				
					
				
			This commit is contained in:
		
						commit
						757f7579d5
					
				| 
						 | 
					@ -8,6 +8,7 @@ try:
 | 
				
			||||||
                               get_username_max_length)
 | 
					                               get_username_max_length)
 | 
				
			||||||
    from allauth.account.adapter import get_adapter
 | 
					    from allauth.account.adapter import get_adapter
 | 
				
			||||||
    from allauth.account.utils import setup_user_email
 | 
					    from allauth.account.utils import setup_user_email
 | 
				
			||||||
 | 
					    from allauth.socialaccount.adapter import get_adapter as get_social_adapter
 | 
				
			||||||
    from allauth.socialaccount.helpers import complete_social_login
 | 
					    from allauth.socialaccount.helpers import complete_social_login
 | 
				
			||||||
    from allauth.socialaccount.models import SocialAccount
 | 
					    from allauth.socialaccount.models import SocialAccount
 | 
				
			||||||
    from allauth.socialaccount.providers.base import AuthProcess
 | 
					    from allauth.socialaccount.providers.base import AuthProcess
 | 
				
			||||||
| 
						 | 
					@ -139,6 +140,12 @@ class SocialLoginSerializer(serializers.Serializer):
 | 
				
			||||||
                        _("User is already registered with this e-mail address.")
 | 
					                        _("User is already registered with this e-mail address.")
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # If signup is disabled, we cannot login a new user
 | 
				
			||||||
 | 
					            if not get_social_adapter(request).is_open_for_signup(request, login):
 | 
				
			||||||
 | 
					                raise serializers.ValidationError(
 | 
				
			||||||
 | 
					                        _("User is not registered but registration is closed.")
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            login.lookup()
 | 
					            login.lookup()
 | 
				
			||||||
            login.save(request, connect=True)
 | 
					            login.save(request, connect=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user