- π©πͺGermany Grevil
This can be still reproduced in 2.x, in "hook_ENTITY_TYPE_presave()" through commenting out
$new_name = email_registration_unique_username($new_name, (int) $account->id());
in line 58 in the email_registration.module.This is quite the edge case, but should be solved nonetheless. I am not a big fan of adding a UUID at the end of the username. Could this eventually solved by executing an SQL transaction?
- π¬π§United Kingdom joachim
> Why not just replace the @ with an underscore and put the whole email address in. There shouldn't be any collisions at all that way, plus every user name could be computed from their email address without added information.
> There is a privacy issue with revealing the user's entire email address as their username, if their username is ever visible.Alternative idea: instead of appending the uid, or the email address, append a short hash of the username. That way we get something (probably!) unique, but we don't need the uid, and we don't expose the email address.
See https://roytanck.com/2021/10/17/generating-short-hashes-in-php/ for instance for creating short hashes.
- π©πͺGermany Anybody Porta Westfalica
Great idea @joachim! Anyone willing to implement that?