diff --git a/extra/modules/root.ptl b/extra/modules/root.ptl index 029ac7a..10bf514 100644 --- a/extra/modules/root.ptl +++ b/extra/modules/root.ptl @@ -66,12 +66,21 @@ class IfefRootDirectory(authentic.root.RootDirectory): def register (self, version=1): identities_cfg = get_cfg('identities', {}) + session = get_session() if not identities_cfg.get('creation') in ('self', 'moderated'): raise errors.TraversalError() form = Form(enctype="multipart/form-data") - for field in identities.get_store_class().fields: + fields = identities.get_store_class().fields + keys = [] + if getattr(session, 'service', None): + keys = get_cfg('providers',{}).get(session.service, {}) \ + .get('registration_fields') + if keys: + fields = [ field for field in fields \ + if field.key in keys ] + for field in fields: if getattr(field, str('on_register'), True): field.add_to_form(form) and None