- Issue created by @eme
- 🇩🇪Germany jurgenhaas Gottmadingen
It is no longer required to have a valid email to create a user in Drupal.
Are you sure? Is there a change record available which explains that significant change?
Actually, looking into the latest code of Drupal 10, the base field definition of the mail field still has a constraint for a required user mail:
$fields['mail'] = BaseFieldDefinition::create('email') ->setLabel(t('Email')) ->setDescription(t('The email of this user.')) ->setDefaultValue('') ->addConstraint('UserMailUnique') ->addConstraint('UserMailRequired') ->addConstraint('ProtectedUserField');
- 🇫🇷France eme
On a fresh Drupal 11 install, as you can see on the attachment, the email field is no longer required.
- Status changed to Closed: works as designed
7 months ago 10:28am 13 September 2024 - 🇩🇪Germany jurgenhaas Gottmadingen
I've done further research and the current situation is the same as it has always been since Drupal 8. The mail field is still required, but there is an exception that the administrator is allowed to edit and delete users without an email address. This has been allowed to prevent missing email addresses from migrating users into Drupal. In that scenario, such records need to be editable to fix them.
The fact that an administrator can not only edit and delete such users but also create new ones without an email is considered an unintentional side-effect and needs to be fixed in Drupal core.
If you create a new user without being an admin, e.g. by using the register account form, then you can see that the email field is marked required.
A discussion about this topic can also be found with more details at https://drupal.slack.com/archives/C1BMUQ9U6/p1726131601768479