diff --git a/src/authentic2_auth_fc/utils.py b/src/authentic2_auth_fc/utils.py index 6037ee6..6e9c35b 100644 --- a/src/authentic2_auth_fc/utils.py +++ b/src/authentic2_auth_fc/utils.py @@ -76,6 +76,8 @@ def mapping_to_value(mapping, user_info): elif 'compute' in mapping: if mapping['compute'] == 'today': value = datetime.date.today() + elif mapping['compute'] == 'random': + value = unicode(uuid.uuid4()) else: raise NotImplementedError @@ -143,7 +145,13 @@ def apply_user_info_mappings(user, user_info): continue if mapping.get('if-tag') and mapping['if-tag'] not in tags: continue - if hasattr(user, attribute): + + if attribute == 'password': + if mapping.get('if-empty') and user.has_usable_password(): + continue + save_user = True + user.set_password(value) + elif hasattr(user, attribute): save_user = True if mapping.get('if-empty') and getattr(user, attribute): continue