1 from django.core.exceptions import ValidationError
2 from django.utils.translation import ugettext as _
3 from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
6 class LooseSocialAccountAdapter(DefaultSocialAccountAdapter):
7 def validate_disconnect(self, account, accounts):
9 Validate whether or not the socialaccount account can be
12 if len(accounts) == 1:
13 # No usable password would render the local account unusable
14 if not account.user.has_usable_password():
15 raise ValidationError(_("Your account has no password set up."))
16 # No email address, no password reset
17 if not account.user.email:
18 raise ValidationError(_("Your account has no e-mail address."))