-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add username sanitisation (12.x) #6075
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
base: 12.x
Are you sure you want to change the base?
Conversation
|
Woops, I see there is a different Pr for 13.x at #6057 Needs to go into 13.x first |
| $new_username = "'" . str_replace(array_keys($username_map), array_values($username_map), $options['sanitize-usernames']) . "'"; | ||
| } elseif ($db_driver === 'mssql') { | ||
| $username_map = ['%uid' => "' + uid + '"]; | ||
| $new_username = "'" . str_replace(array_keys($username_map), array_values($username_map), $options['sanitize-email']) . "'"; |
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.
I think the $options['sanitize-email'] is a copy-paste error and should be replaced into $options['sanitize-usernames']
| #[CLI\Option(name: 'sanitize-usernames', description: 'Sanitize the names of users by replacing the originals with user+UID, or <info>no</info> to keep usernames unchanged.')] | ||
| #[CLI\Option(name: 'ignored-roles', description: 'A comma delimited list of roles. Users with at least one of the roles will be exempt from sanitization.')] | ||
| public function options($options = ['sanitize-email' => 'user+%[email protected]', 'sanitize-password' => null, 'ignored-roles' => null]): void | ||
| public function options($options = ['sanitize-email' => 'user+%[email protected]', 'sanitize-password' => null, 'sanitize-usernames' => 'user+%uid', 'ignored-roles' => null]): void |
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.
I'm not sure "+" is an allowed character for drupal username in the admin.
Maybe the default value in the command should be an underscore to avoid potential breaking?
Fixes #4609 for projects on drush 12.x