diff --git a/ChangeLog.rst b/ChangeLog.rst index 84b7391..5bc9d26 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,8 +1,13 @@ Dev *** +Version 0.3.0 +************* + * [impr] add focus on first input of forms +* [impr] add 404 (default) handler and its error page * [feat] add a -D switch to ldapcherryd which enables logging to stderr in foreground +* [feat] print user's attribute on index page Version 0.2.5 ************* diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index fc99f5c..77511ba 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -885,8 +885,19 @@ class LdapCherry(object): """ self._check_auth(must_admin=False) is_admin = self._check_admin() + sess = cherrypy.session + user = str(sess.get(SESSION_KEY, None)) + if self.auth_mode == 'none': + user_attrs = None + else: + user_attrs = self._get_user(user) + attrs_list = self.attributes.get_search_attributes() + print attrs_list + print user_attrs return self.temp['index.tmpl'].render( is_admin=is_admin, + attrs_list=attrs_list, + searchresult=user_attrs, notifications=self._empty_notification(), ) diff --git a/resources/templates/index.tmpl b/resources/templates/index.tmpl index e35ba1b..7b9757c 100644 --- a/resources/templates/index.tmpl +++ b/resources/templates/index.tmpl @@ -1,4 +1,33 @@ ## -*- coding: utf-8 -*- <%inherit file="navbar.tmpl"/> <%block name="core"> +
+
+
+
+
+ Your attributes: + + + % if not searchresult is None: + %for attr in sorted(attrs_list.keys(), key=lambda attr: attrs_list[attr]['weight']): + + % if attr in searchresult: + <% + value = searchresult[attr] + if type(value) is list: + value = ', '.join(value) + %> + + + % endif + + % endfor + %endif + + + +
+
+
${attrs_list[attr]['display_name']}:${value}