-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/drupal#127 - require email for the Useradd task and errors not showing #17915
dev/drupal#127 - require email for the Useradd task and errors not showing #17915
Conversation
(Standard links)
|
@@ -56,6 +56,9 @@ public function createUser(&$params, $mail) { | |||
// Validate the user object | |||
$violations = $account->validate(); | |||
if (count($violations)) { | |||
foreach ($violations as $violation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy do we need to do this on other CMSes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For drupal 7 no, because of the way it uses drupal's form layer to create a user, so the form errors display.
Let's take a look at what wordpress/joomla do...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok it took a minute to find but it looks like wordpress doesn't override checkPermissionAddUser() so it returns false so you don't even see this feature.
Ok now joomla...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Joomla UF class has pretty extensive checking as a form rule via checkUserNameEmailExists(), and it's beyond my joomla knowledge to know how to get past it to trigger a fail in joomla itself. The only thing I can see it doesn't check for is a blank email, which this PR would cover. But createUser itself doesn't have any kind of error checking, and in fact seems like it would never return FALSE either way, so technically createUser might need some sprucing up, but I'm not a joomla person.
@kcristiano @mattwire Thoughts on this? I think it seems fine to me from a Drupal 7/8 POV |
@kcristiano @christianwach @andrewpthompson thoughts? |
If it helps here's an updated table about what happens when you use the Create User Record action from the view contact summary for a contact who has no email.
|
@eileenmcnaughton WordPress would appear to be unaffected by this PR since the the feature doesn't appear as an action. This can already be done in WordPress via:
Having said all that, IMO it would be nice to have this in core at some stage. |
I've tried to ping a few Joomla! people & also pasted on chat. Unfortunately Joomla! world is a bit quiet - I think at this stage I'm going to merge it - but @agh1 can you try to give some visibility to the fact this may change Joomla! behaviour in the release notes. I think it would be easy to fix if the change is considered regressive @vingle pinging you as someone else with some Joomla! knowledge |
Thanks for that analysis @christianwach |
I've only given this a quick test on Joomla, and only for the case of trying to create a CMS user with no email address. The patch works as intended. For info, before the patch: Joomla user is not created. No error is displayed by Joomla. Civi show a success message. I'm not particularly familiar with this part of Joomla/Civi interaction but it looks OK to me. |
Thanks @andrewpthompson - appreciate your feedback |
Thanks everybody. |
Overview
https://lab.civicrm.org/dev/drupal/-/issues/127
This is more noticeable on drupal 8 because in drupal 7 the CMS prevents it and outputs its own error message, but either way the "Create User Record" action when viewing a contact doesn't properly display or check for errors when creating the CMS user.
no messagea success message but the CMS user is not created.That doesn't happen because of a separate bug(dev/drupal#127 - CRM_Core_Session::setStatus() gets ignored sometimes #17914), but you can see there's no check on the return value from the create call.Before
Missing or incorrect message. Also the actual cause of the error is not recorded or displayed anywhere.
After
Proper message and cause displayed.
Technical Details
Also to be in line with https://lab.civicrm.org/dev/drupal/-/issues/91 I made email required on the form to head off errors from that.
Comments
Has test.