Add a configuration property for the forms to which the user restrictions are applied.
Original report
Problem/Motivation
Add options to check user restrictions only when registering, not when logging in.
This would be helpful for cases where you want an 'Official' account on the site but don't want users creating usernames with the word 'Official' in them.
Steps to reproduce
- Create 'sage_official' account
- Add 'official' as a blocked word on user accounts
- Logging in as sage_official is no longer allowed
Proposed resolution
- Create option to block on login and/or registration.
- Allow existing accounts to log in
Note: whitelisting is an option, but in my case there are over 100 accounts that need to be whitelisted. It would be easier if it only blocks users from creating new accounts with the blacklisted text.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | user_restriction_registrations.patch | 3.87 KB | shank115 |
Issue fork user_restrictions-3511725
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
shank115 commentedPatch contains a "Block on registration only" checkbox to the User Restriction config form. When checked, the restriction will only apply during user registration, not during login.
This patch currently adds functionality only for username based restrictions.
version: 2.0.x
Drupal version: 10.5.2
Comment #3
sagesolutions commentedHi @shank115, thanks for the patch. I reviewed it and I'm pretty sure you can remove the submit() function. The file extends EntityForm, which automatically sets fields into values.
Is it possible to create a Merge Request instead of a patch? It will be easier to update the code this way. Thanks!
Comment #4
avpadernoUser restrictions also allow a value to be used. Instead of
$block_on_registration, the name should be more generic.Comment #5
avpadernoComment #6
avpadernoComment #8
avpadernoComment #10
avpadernoComment #12
avpadernoComment #14
avpaderno