Revision 649f2d36
b/snf-astakos-app/astakos/im/forms.py | ||
---|---|---|
971 | 971 |
del self.fields['change_password'] |
972 | 972 |
|
973 | 973 |
|
974 |
if EMAILCHANGE_ENABLED: |
|
974 |
if EMAILCHANGE_ENABLED and self.instance.can_change_email():
|
|
975 | 975 |
self.email_change = True |
976 | 976 |
else: |
977 | 977 |
self.fields_list.remove('new_email_address') |
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
589 | 589 |
def can_change_password(self): |
590 | 590 |
return self.has_auth_provider('local', auth_backend='astakos') |
591 | 591 |
|
592 |
def can_change_email(self): |
|
593 |
non_astakos_local = self.get_auth_providers().filter(module='local') |
|
594 |
non_astakos_local = non_astakos_local.exclude(auth_backend='astakos') |
|
595 |
return non_astakos_local.count() == 0 |
|
596 |
|
|
592 | 597 |
def has_required_auth_providers(self): |
593 | 598 |
required = auth_providers.REQUIRED_PROVIDERS |
594 | 599 |
for provider in required: |
Also available in: Unified diff