def handle_use_email_as_login(obj, event): """Additional configuration when the ``use_email_as_login`` setting is updated in the ``Security```control panel. If the setting is enabled, existing users' login names are migrated to email. If the setting is disabled, then the login names are migrated back to user ids. """ if event.record.fieldName != 'use_email_as_login': return value = event.newValue if value == event.oldValue: # no change return context = getSite() if value: migrate_to_email_login(context) else: migrate_from_email_login(context)
def switch_to_email(self): # This is not used and is only here for backwards # compatibility. It avoids a test failure in # Products.CMFPlone. # XXX: check if this can be removed migrate_to_email_login(self.context)