Closed (fixed)
Project:
Email Registration
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2019 at 16:52 UTC
Updated:
28 Jan 2020 at 17:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ben coleman commentedThe attached patch implements the above - if the user has the 'change own username' permission, the username field is presented for normal editing. I don't check for whether the user is editing his own profile, or whether the user has the 'Administer users' permission, as I assume that if the user can get to the user edit page, one of these two situations applies. This means that a user that has the 'Administer users' permission *and* the 'change own username' permission will be able to change other user's usernames. Tweaking will be required if this is not acceptable.
Note that this patch expects that the patch from #3024558-19: Username regenerated improperly after rc6 release has been applied.
Comment #4
ben coleman commentedHmmm. Is there a way to specify to the test mechanism that another patch needs to be applied in addition to the patch being tested?
Comment #5
gregglesThere is not. You could help write tests for that other patch - that's the last thing it needs to get committed :)
Comment #6
brandonratz commentedWould be great to have this working properly. I was unable to apply this patch after applying https://www.drupal.org/files/issues/2019-03-04/Strange-username-logic-af...
Comment #7
ben coleman commentedBrandon: note that I used #3024558-19: Username regenerated improperly after rc6 release (patch from comment 19), while you used the patch from comment 44. You might (at least temporarily) try the comment 19 patch before trying the patch for this issue.
Since #3024558: Username regenerated improperly after rc6 release still seems to be somewhat in flux, and the code from this issue overlaps with the code form there, it might be best to wait until #3024558: Username regenerated improperly after rc6 release is settled and commitded before finalizing a patch for this issue.
Comment #8
greggles#3024558: Username regenerated improperly after rc6 release was committed, so this can now be re-rolled.
It also seems like this needs fixes in 2 places:
* registration
* account management
The latest patch only addresses registration.
And, ideally, this should get tests to make sure we don't break it again.
Comment #9
gregglesPardon me, this affects both registration and account management since the form gets re-used. But another important detail is handling an admin looking at a user's form.
Comment #10
gregglesStill needs tests, but here's a patch for review.
Comment #11
andypostIt needs check that form element exists at least
Comment #12
vacho commentedI update the code with #11 enhancement and test the solution.
Before the patch review:

After the patch review:

Comment #13
kle commentedA good solution is very welcome. My own hack only resets the name#type to 'textfield' ...
Comment #14
d.fisher commentedPatch in #12 fails for me.
Comment #15
greggles@darren.fisher - do you mean it fails to apply or that it doesn't solve the problem as you experience it. If it doesn't solve the problem, could you provide more details about your configuration and what you expect to see and what you do see?
Comment #16
d.fisher commentedSorry greggles I kind of wrote that as a bit of a throwaway without much context. My bad! The patch failed to apply against 1.0.0-rc7 using Drupal core 8.6.15. Didn't test against dev as I needed to use in production. Hope that helps a bit more.
Comment #17
greggles@vacho can you clarify what situation your patch helps vs. the prior?
Comment #18
asherry commentedYeah I agree, it'd be great to get more details @vacho @andypost. What's the context where
$form['account']['name']['#type']wouldn't be set?Could we maybe move that to a separate ticket and release this?
I fixed a small typo with
\Drupal::CurrentUserinstead of\Drupal::currentUser, and added a test for this, but this is based on #10 and not #12.This is pretty crucial for our instance.
Thanks so much @greggles!
Comment #19
andypost@asherry Sorry my bad, mixed with default value in #3024558: Username regenerated improperly after rc6 release
Here's small clean-up and test-only patch because it's bug
Comment #20
andypostReady for commit
Comment #22
andypostCleaned on commit