We are setting up our internal/intranet Plone site for our company. We would like to use self-registration and have users use their email addresses as their login name. However, we would like to restrict the allowable email addresses to be our company provided email addresses.
I can't find any setting to do that and neither reading documentation nor Google Fu has yielded any results. Does anyone have any suggestions?
We use a monkey patch for doing a custom email validation in one project:
from plone.app.users.browser.register import BaseRegistrationForm
def validate_registration(self, action, data):
# pick email from from data and validate against CiviCRM
result = user_by_email(data['email'])
if not result:
err_str = _(u'Email not found in CRM')
notifyWidgetActionExecutionError(action, 'email', err_str)
# perform original validation
return old_validate_registration(self, action, data)
# monkey-patch registration validation
old_validate_registration = BaseRegistrationForm.validate_registration
BaseRegistrationForm.validate_registration = validate_registration