1. Zhang Huangbin
  2. iredadmin-ose

Commits

Zhang Huangbin  committed f01fbe6

* Add catch-all msg control.
* Ability to update telephonenumber.

  • Participants
  • Parent commits 10c7656
  • Branches default

Comments (0)

Files changed (2)

File libs/ldaplib/user.py

View file
             cn = data.get('cn', None)
 
             if cn is not None:
-                mod_attrs = [ ( ldap.MOD_REPLACE, 'cn', cn.encode('utf-8') ) ]
+                mod_attrs += [ ( ldap.MOD_REPLACE, 'cn', cn.encode('utf-8') ) ]
             else:
                 # Delete attribute.
-                mod_attrs = [ ( ldap.MOD_DELETE, 'cn', None) ]
+                mod_attrs += [ ( ldap.MOD_DELETE, 'cn', None) ]
 
             # Get mail address.
 
             # Get mailQuota.
-            mailQuota = web.safestr(data.get('mailQuota', None))
+            mailQuota += web.safestr(data.get('mailQuota', None))
             if mailQuota == '':
                 # Don't touch it, keep old quota value.
                 pass
             else:
-                mod_attrs = [ ( ldap.MOD_REPLACE, 'mailQuota', str(int(mailQuota) * 1024 * 1024) ) ]
+                mod_attrs += [ ( ldap.MOD_REPLACE, 'mailQuota', str(int(mailQuota) * 1024 * 1024) ) ]
+
+            # Get telephoneNumber.
+            telephoneNumber = data.get('telephoneNumber', [])
+            if telephoneNumber != []:
+                mod_attrs += [ (ldap.MOD_REPLACE, 'telephoneNumber', None) ]
+                for i in telephoneNumber:
+                    #mod_attrs += [ (ldap.MOD_REPLACE, 'telephoneNumber', str(i)) ]
+                    mod_attrs += [ (ldap.MOD_ADD, 'telephoneNumber', str(i)) ]
 
             # Get accountStatus.
             accountStatus = web.safestr(data.get('accountStatus', 'active'))

File templates/default/ldap/user_profile.html

View file
                     {{ _('New password must contain at least %s characters.') |format(min_passwd_length) }}
                 {% elif msg == 'PW_GREATER_THAN_MAX_LENGTH' %}
                     {{ _('New password must NOT contain more than %s characters.') |format(max_passwd_length) }}
+                {% else %}
+                {# Catch-all #}
+                <div class="error">
+                    {{ msg }}
+                </div>
                 {% endif %}
             </div>
             {% endif %}