1. Zhang Huangbin
  2. iredadmin-ose

Commits

Zhang Huangbin  committed 1277c84

Display username part of mail address when cn is not present.

  • Participants
  • Parent commits 1d7d079
  • Branches default

Comments (0)

Files changed (2)

File templates/default/ldap/admins.html

View file
             {% set accountStatus = entry.get('accountStatus', ['disabled'])[0] %}
             {% set domainGlobalAdmin = entry.get('domainGlobalAdmin', ['no'])[0] %}
 
+            {# Display username part of mail address when cn is empty. #}
+            {% if cn == '' %}
+                {% set cn = mail.split('@', 1)[0] %}
+            {% endif %}
+
             <tr class="{{ loop.cycle('odd', 'even') }} {{ accountStatus |lower }}">
                 <td>
                     <span class="float_left">

File templates/default/ldap/users.html

View file
                 {% set accountStatus = entries.get('accountStatus', ['disabled'])[0] %} 
                 {% set createTimestamp = entries.get('createTimestamp', ['--------------'])[0] %}
 
+                {# Display username part of mail address when cn is empty. #}
+                {% if cn == '' %}
+                    {% set cn = mail.split('@', 1)[0] %}
+                {% endif %}
+
                 <tr class="{{ loop.cycle('odd', 'even') }} {{ accountStatus |lower }}">
                     <td>
                         <span class="float_left">
                             <input type="checkbox" name="mail" value="{{mail}}" />
-                            <a href="{{ctx.homepath}}/profile/user/general/{{mail}}" title="{{ _('Edit user profile.') }}">{{ entries.get('cn', [''])[0].decode('utf-8') }}</a>
+                            <a href="{{ctx.homepath}}/profile/user/general/{{mail}}" title="{{ _('Edit user profile.') }}">{{ cn }}</a>
                         </span>
                         <span class="float_right">{{ set_account_status_img(accountStatus) }}</span>
                     </td>