Commits

Zhang Huangbin  committed 4a08779

Show password length restriction.

  • Participants
  • Parent commits 196aebf

Comments (0)

Files changed (2)

File controllers/ldap/admin.py

 from controllers.ldap.basic import dbinit
 from libs.ldaplib import admin, preferences
 
+cfg = web.iredconfig
 session = web.config.get('_session')
 
 adminLib = admin.Admin()
                 profile_type=self.profile_type,
                 cur_lang=self.langs['cur_lang'],
                 langmaps=self.langs['langmaps'],
+                min_passwd_length=cfg.general.get('min_passwd_length'),
+                max_passwd_length=cfg.general.get('max_passwd_length'),
                 msg=i.get('msg', None),
                 )
 
                     profile_type=self.profile_type,
                     cur_lang=cur_lang,
                     langmaps=self.langs['langmaps'],
+                    min_passwd_length=cfg.general.get('min_passwd_length'),
+                    max_passwd_length=cfg.general.get('max_passwd_length'),
                     msg=result[1],
                     )

File templates/default/ldap/admin_profile.html

 {# defined: profile_type, mail, cur_lang, langmaps, [msg], #}
-
 {% extends "layout.html" %}
+{% from "macros.html" import display_reset_password, %}
 
 {% block js_tablesorter %}{% endblock %}
 
 {% endif %}
 
 {% if profile_type == 'password' %}
-    <div class="main-frm">
-        <div class="sf-set">
-            <div class="sf-box text">
-                <label><span>{{ _('Current password') }}</span></label><br />
-                <span class="fld-input"><input type="password" id="cur_passwd" name="cur_passwd" size="25" /></span>
-            </div>
+    {% if session.get('domainGlobalAdmin') == 'yes' %}
+        {{ display_reset_password(
+                show_confirmpw='yes',
+                min_passwd_length=min_passwd_length,
+                max_passwd_length=max_passwd_length)
+                }}
+    {% else %}
+        {{ display_reset_password(
+                show_oldpw='yes',
+                show_confirmpw='yes',
+                min_passwd_length=min_passwd_length,
+                max_passwd_length=max_passwd_length)
+                }}
+    {% endif %}
 
-            <div class="sf-box text">
-                <label><span>{{ _('New password') }}</span></label><br />
-                <span class="fld-input"><input type="password" name="newpw" size="25" /></span>
-            </div>
-
-            <div class="sf-box text">
-                <label><span>{{ _('Retype new password') }}</span></label><br />
-                <span class="fld-input"><input type="password" name="confirmpw" size="25" /></span>
-            </div>
-        </div>
-    </div>
 {% endif %}
 
     <div class="frm-buttons">