Currently, a user can be added without an email address (the field is optional). However, as soon as a user receives an email address, the email field becomes required. This leaves things in a sort of halfway state. It seems like one of the following should be true:
- It is valid for a user to have no email address. If this is the case, then the field should not be required on user edit. (Otherwise you can't return a user to this state after an address has been entered.)
- A user must have an email address defined. If this is the case, then the field should be required on user add also.
I'm not sure which way is preferred, but it would be great if this experience was consistent.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | email_fields.png | 282.2 KB | mlahde |
Comments
Comment #4
dpiConfirmed issue on 8.3
Comment #5
hgoto commentedThe following issue is related and useful to know the reason.
#189544: Allow administrator to edit account without email address (regression: accounts can be created without email addresses also)
Comment #7
mpp commentedThis seems like a major issue.
Comment #8
alokbhatt commentedI am using 8.3.2 and as an Administer, I can see in both the cases, Add and Edit user, email field is not mandatory.
So would Email field be mandatory in both cases or some cases? Please provide detail requirement.
Comment #11
mlahde commentedThis is still valid in Drupal 8.5.2, please see "/admin/people/create" and "/user/xxx/edit", where xxx is the user ID.
I attached a screen shot also.
We have a Drupal site where there shouldn't be emails used at all. The users are migrated to the system without email adresses and that works fine. Unfortunately they cannot be edited (for example to change the password or deleted) because the email is a mandatory field. This is a bit contradictory since you can also create a user without an email through UI.
Comment #12
bohemier commentedI agree with this inconsistency and am running into the same issue with 8.5.3.
In the meantime I was able to get around this by implementing hook_user_form_form_alter:
and in
Comment #13
gmem commentedI wonder how effective a simple checkbox for toggling whether an email is required or not would be, either by removing the required tag or removing the input/validation entirely. This way it would be entirely possible to add and edit users without needing to fill in the email field, since according to #11 the email field doesn't seem to be required in the database itself.
Comment #15
aaronmchaleRegarding #13 I wonder if we could utilise the existing "required" checkbox that Fields have as a configuration option, as in somehow expose that option for the Email field in the Field UI.
Comment #16
dpiComment #22
quietone commentedTriaged during a BugSmash group triage meeting with myself and darvanen in the thread.
We agree this is Normal priority. And, of course, BC will need to be considered.
This also needs an issue summary update, noting the proposed resolution in #13, see Write an issue summary for an existing issue for guidance. Updating the IS for this issue is suitable for a novice task, adding tag.
Comment #23
quietone commentedOn further discussion, darvanen found a duplicate, #286401: Make email not required for a Drupal site account. And lendude joined noting that #2227381: Apply formatters and widgets to User base fields 'name' and 'email' is likely the 'root fix'.
Therefor closing this issue as a duplicate.