dev/core#3467 - Drupal 8 - Skip requirement for password when changing your own civi contact's email #23546
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Modifying your own email from civi does not modify it in drupal, but you can modify any email of any contact and its sync fine. It works fine in D7.
This is happening in both Drupal 8 and 9.
I found this validation when contact is updated and Symfony throws the error:
Source: https://github.com/civicrm/civicrm-core/blob/5.45.1/CRM/Utils/System/Drupal8.php#L117
Before
The logged in user cannot update his own email in drupal from CiviCRM.
After
The logged in user can update his own email in drupal from CiviCRM.
Technical Details
I found this parameter
$user->_skipProtectedUserFieldConstraint = TRUE;
that allows to skip the validation or at least does not ask for the password, I have doubts if this can cause any unwanted behavior.Comments
issue: https://lab.civicrm.org/dev/core/-/issues/3467
Tested with D9 with CiviCRM 5.45
Thanks!