Revision 17ad5d37

b/snf-astakos-app/astakos/im/forms.py
64 64
    RECAPTCHA_ENABLED, DEFAULT_CONTACT_EMAIL, LOGGING_LEVEL,
65 65
    PASSWORD_RESET_EMAIL_SUBJECT, NEWPASSWD_INVALIDATE_TOKEN,
66 66
    MODERATION_ENABLED, PROJECT_MEMBER_JOIN_POLICIES,
67
    PROJECT_MEMBER_LEAVE_POLICIES)
67
    PROJECT_MEMBER_LEAVE_POLICIES, EMAILCHANGE_ENABLED)
68 68
from astakos.im.widgets import DummyWidget, RecaptchaWidget
69 69
from astakos.im.functions import (
70 70
    send_change_email, submit_application, do_accept_membership_checks)
......
928 928

  
929 929
    password_change_form = None
930 930
    email_change_form = None
931

  
931 932
    password_change = False
933
    email_change = False
934

  
932 935
    extra_forms_fields = {
933 936
        'email': ['new_email_address'],
934 937
        'password': ['old_password', 'new_password1', 'new_password2']
......
944 947
        else:
945 948
            del self.fields['change_password']
946 949

  
950
        if EMAILCHANGE_ENABLED:
951
            self.email_change = True
952
        else:
953
            del self.fields['change_email']
954

  
955

  
947 956
        self._init_extra_forms()
948 957
        self.save_extra_forms = []
949 958
        self.success_messages = []
950 959

  
951 960
    def _init_extra_form_fields(self):
952
        self.fields.update(self.email_change_form.fields)
953
        self.fields['new_email_address'].required = False
961
        if self.email_change:
962
            self.fields.update(self.email_change_form.fields)
963
            self.fields['new_email_address'].required = False
954 964

  
955 965
        if self.password_change:
956 966
            self.fields.update(self.password_change_form.fields)
b/snf-astakos-app/astakos/im/views.py
719 719
    extra_context = extra_context or {}
720 720

  
721 721

  
722
    if not astakos_settings.EMAILCHANGE_ENABLED:
723
        raise PermissionDenied
724

  
722 725
    if activation_key:
723 726
        try:
724 727
            user = EmailChange.objects.change_email(activation_key)

Also available in: Unified diff