Commits

Zhang Huangbin committed de15af5

Fix admin profile issue.

Comments (0)

Files changed (2)

controllers/ldap/admin.py

                 self.profile = adminLib.profile(self.mail)
 
                 # Get available languages.
-                return render.admin_profile(
-                        mail=self.mail,
-                        profile_type=self.profile_type,
-                        profile=self.profile,
-                        languagemaps=adminLib.getLanguageMaps(),
-                        msg=i.get('msg', None),
-                        )
+                if self.profile[0] is True:
+                    return render.admin_profile(
+                            mail=self.mail,
+                            profile_type=self.profile_type,
+                            profile=self.profile[1],
+                            languagemaps=adminLib.getLanguageMaps(),
+                            msg=i.get('msg', None),
+                            )
+                else:
+                    web.seeother('/profile/admin/%s/%s?msg=%s' % (self.profile_type, self.mail, self.profile[1]))
             elif self.profile_type == 'password':
                 return render.admin_profile(
                         mail=self.mail,

templates/default/ldap/admin_profile.html

 
 <form class="frm-form" method="post" action="{{ctx.homepath}}/profile/admin/{{profile_type}}/{{mail}}">
 {% if profile_type == 'general' %}
-    {% if profile[0] is sameas true %}
-        {% set entry = profile[1][0][1] %}
-        {% set cn = entry.get('cn', [''])[0].decode('utf-8') %}
-        {% set preferredLanguage = entry.get('preferredLanguage', ['en_US'])[0] |string %}
-    {% endif %}
+    {% set entry = profile[0][1] %}
+    {% set cn = entry.get('cn', [''])[0].decode('utf-8') %}
+    {% set preferredLanguage = entry.get('preferredLanguage', ['en_US'])[0] |string %}
 
     {{ display_cn(
             value=cn,