1. Zhang Huangbin
  2. iredadmin-ose

Commits

Zhang Huangbin  committed eb804b2

Fix error while update domain with empty cn.

  • Participants
  • Parent commits e636c94
  • Branches default

Comments (0)

Files changed (4)

File controllers/ldap/domain.py

View file
  • Ignore whitespace
         if self.profile_type not in ['general', 'admins', 'services', 'bcc', 'quotas', 'backupmx', 'advanced', ]:
             web.seeother('/domains?msg=INCORRECT_PROFILE_TYPE')
 
-        print >> sys.stderr, self.domain
         result = domainLib.profile(domain=self.domain)
 
         if result[0] is True:
                     admins=allAdmins,
                     # We need only mail address of domain admins.
                     domainAdmins=domainAdmins[0][1].get('domainAdmin', []),
-                    msg='SUCCESS',
                     )
         else:
             web.seeother('/domains?msg=%s' % result[1])

File libs/ldaplib/domain.py

View file
  • Ignore whitespace
         mod_attrs = []
         if self.profile_type == 'general':
             cn = data.get('cn', None)
-            if cn is not None:
+            if cn is not None and len(cn) != 0:
                 mod_attrs += [ ( ldap.MOD_REPLACE, 'cn', cn.encode('utf-8') ) ]
             else:
                 # Delete attribute.

File libs/ldaplib/user.py

View file
  • Ignore whitespace
             # Get cn.
             cn = data.get('cn', None)
 
-            if cn is not None:
+            if cn is not None and len(cn) != 0:
                 mod_attrs += [ ( ldap.MOD_REPLACE, 'cn', cn.encode('utf-8') ) ]
             else:
                 # Delete attribute.

File templates/default/ldap/domain_profile.html

View file
  • Ignore whitespace
 {% if msg is defined and msg is not sameas none %}
     <div class="ct-box info-box">
         {% if msg == 'SUCCESS' %}
-        <div class="success">
-            {{ _('Profile update success.') }}
-        </div>
+        <div class="success">{{ _('Profile update success.') }}</div>
         {% else %}
             {# Password #}
             {% if profile_type == 'password' %}