diff --git a/management/univention-self-service/umc/python/passwordreset/__init__.py b/management/univention-self-service/umc/python/passwordreset/__init__.py index 11aadc7d75..84da593c65 100644 --- a/management/univention-self-service/umc/python/passwordreset/__init__.py +++ b/management/univention-self-service/umc/python/passwordreset/__init__.py @@ -296,13 +296,14 @@ def get_user_attributes(self, username, password): user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')] + user = self.get_udm_user(username=username) widget_descriptions = [] label_overwrites = { 'jpegPhoto': _('Your picture') } for propname in user_attributes: prop = self.usersmod.property_descriptions.get(propname) - if not prop: + if not prop or not user.has_property(propname): continue widget_description = { @@ -314,6 +315,7 @@ def get_user_attributes(self, username, password): 'required': bool(prop.required), 'readonly': not bool(prop.editable), 'multivalue': bool(prop.multivalue), + 'value': user[propname], } widget_description.update(widget(prop.syntax, widget_description)) if 'udm' in widget_description['type']: @@ -327,9 +329,8 @@ def get_user_attributes(self, username, password): layout = [propname for propname in user_attributes if propname in [wd['id'] for wd in widget_descriptions]] values = {} - user = self.get_udm_user(username=username) for propname in user_attributes: - if propname in user: + if user.has_property(propname): values[propname] = user[propname] return { @@ -400,12 +401,11 @@ def set_user_attributes(self, username, password, attributes): user_attributes = [attr.strip() for attr in ucr.get('self-service/udm_attributes', '').split(',')] user = self.get_udm_user_by_dn(userdn=dn, admin=True) for propname, value in attributes.items(): - if propname in user_attributes: + if propname in user_attributes and user.has_property(propname): user[propname] = value user.modify() return _("Successfully changed your contact data.") - @forward_to_master @prevent_denial_of_service @sanitize(