Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 805c15aa298a libs/ldaplib/domain.py
- --- a/libs/ldaplib/domain.py Wed Dec 19 12:10:39 2018 +0800
- +++ b/libs/ldaplib/domain.py Wed Dec 19 22:46:13 2018 +0800
- @@ -1321,50 +1321,37 @@
- elif profile_type == 'bcc':
- # Enable/Disable recipient bcc.
- - if 'recipientbcc' in form:
- - mod_type = 'add'
- - else:
- - mod_type = 'delete'
- -
- - result = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
- - attr='enabledService',
- - values=['recipientbcc'],
- - action=mod_type,
- - conn=conn)
- - if result[0] is False:
- - return result
- -
- - # Update recipient bcc address.
- - rcpt_bcc = form_utils.get_single_value(form,
- - input_name='recipientBccAddress',
- - default_value=None,
- - is_email=True,
- - to_string=True)
- - mod_attrs += ldaputils.get_mod_replace(attr='domainRecipientBccAddress',
- - value=rcpt_bcc)
- -
- - # Enable/Disable sender bcc.
- - if 'senderbcc' in form:
- - mod_type = 'add'
- - else:
- - mod_type = 'delete'
- -
- - result = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
- - attr='enabledService',
- - values=['senderbcc'],
- - action=mod_type,
- - conn=conn)
- - if result[0] is False:
- - return result
- -
- - # Update sender bcc address.
- - sender_bcc = form_utils.get_single_value(form,
- - input_name='senderBccAddress',
- - default_value=None,
- - is_email=True,
- - to_string=True)
- - mod_attrs += ldaputils.get_mod_replace(attr='domainSenderBccAddress',
- - value=sender_bcc)
- + # form input name is same as ldap attribute value.
- + for _input_name in ['recipientbcc', 'senderbcc']:
- + if _input_name in form:
- + mod_type = 'add'
- + else:
- + mod_type = 'delete'
- +
- + _qr = ldap_lib_general.add_or_remove_attr_values(dn=domaindn,
- + attr='enabledService',
- + values=[_input_name],
- + action=mod_type,
- + conn=conn)
- +
- + if not _qr[0]:
- + return result
- +
- + # Update sender/recipient bcc address.
- + for (_input_name, _attr) in [('senderBccAddress', 'domainSenderBccAddress'),
- + ('recipientBccAddress', 'domainRecipientBccAddress')]:
- + _bcc_addr = form_utils.get_single_value(form,
- + input_name=_input_name,
- + default_value='',
- + is_email=True,
- + to_string=True)
- +
- + if _bcc_addr:
- + mod_attrs += ldaputils.get_mod_replace(attr=_attr,
- + value=_bcc_addr)
- + else:
- + mod_attrs += ldaputils.get_mod_replace(attr=_attr,
- + value=None)
- elif profile_type == 'relay':
- # transport
- diff -r 805c15aa298a templates/default/macros/general.html
- --- a/templates/default/macros/general.html Wed Dec 19 12:10:39 2018 +0800
- +++ b/templates/default/macros/general.html Wed Dec 19 22:46:13 2018 +0800
- @@ -1550,7 +1550,7 @@
- {%- endmacro %}
- {% macro display_recipient_bcc(address='', label='', input_name='recipientBccAddress') -%}
- - {% if address is sameas none %}
- + {% if not address %}
- {% set address = '' %}
- {% endif %}
- @@ -1566,7 +1566,7 @@
- {%- endmacro %}
- {% macro display_sender_bcc(address='', label='', input_name='senderBccAddress') -%}
- - {% if address is sameas none %}
- + {% if not address %}
- {% set address = '' %}
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement