- 🇸🇰Slovakia poker10
There is a comment on that field:
// The mail field is NOT required if account originally had no mail set // and the user performing the edit has 'administer users' permission. // This allows users without email address to be edited and deleted.
I think we should not set TRUE for every case, just fix that
#required
condition to match only when editing an existing user account. If I am not mistaken, currently this condition:(!$account->getEmail() && $user->hasPermission('administer users'))
will be TRUE also when creating a new account and I think we want email in this case.
- First commit to issue fork.
- Merge request !9876Make the email address field required when creating a new user → (Open) created by dieterholvoet
- 🇺🇸United States smustgrave
Appears to have test failures
But seems like a change we could maybe add an assertion to an existing test to verify the change.
Just noting here that ✨ Make email not required for a Drupal site account Active is a mostly opposite effort. As to a use case where emails would not be required on registration, see #77 ✨ Make email not required for a Drupal site account Active :
Also here via search, also building a site involving user accounts for people of all ages, including very young, for whom an email address is inappropriate. It'd be great if this wasn't necessarily a required property/base field.
- 🇺🇸United States vpowner
For my use case where email address is required for password resets, I used [module_name]_form_user_register_form_alter in my .module file and $form['account']['mail']['#required'] = true;
For non-tech users and keeping things simple, I'd suggest adding a checkbox to the settings form /admin/config/people/accounts which would be next to the "Require email verification when a visitor creates an account" and have it say something like "Email required on new accounts".