Problem/Motivation
User sees the message "You are not allowed to login from this IP address. Please contact the Site Administrator." even after successfully logging in to the site.
Steps to reproduce
1. Restrict login for any role
2. Open incognito window or other browser and log in with any user with same role. Unauthorised message is shown.
3. Go to the admin window and remove restriction for the role.
4. Go back to the previous login window and attempt to log in.
5. Login successful with Unauthorised error message shown.
Proposed resolution
The browser window is taking the previous query parameters for next request. Need to redirect to fresh login page after showing error message.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | error_message_on_false_condition_fix-3240046-4.patch | 1.68 KB | supreetam09 |
| #2 | error_message_on_false_condition_fix-3240046-2.patch | 1.08 KB | supreetam09 |
Issue fork restrict_role_login_by_ip-3240046
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
supreetam09 commentedHere is the patch to fix.
Comment #3
mohit_aghera commentedYou might need to re-roll the patch against 1.x branch.
The current patch seems to be with a different branch.
This issue might be temporary until we switch to semantic versioning.
Comment #4
supreetam09 commentedHere is the patch against 1.x branch.
Comment #5
mohit_aghera commentedI think there is some confusion here.
We are subscribing "KerenelEvents::REQUEST"
It primarily takes "RequestEvent" object argument.
Can you please confirm once.
https://symfony.com/doc/current/components/http_kernel.html#component-ht...
Comment #6
supreetam09 commentedSymfony\Component\HttpKernel\Event\RequestEvent class is available from symfony/http-kernel:^4.0 and above.
RequestEvent object can be used in D9 since it supports symfony/http-kernel: ^4.4 (https://packagist.org/packages/drupal/core#9.2.6)
Drupal 8 core supports upto symfony/http-kernel: ~3.4.14 (https://packagist.org/packages/drupal/core#8.9.19)
In D8, we need to use class \Symfony\Component\HttpKernel\Event\GetResponseEvent to correspond "KerenelEvents::REQUEST"
If we want to use RequestEvent object, we need to create a D9 specific release.
In D8, it will throw error.
Let me know your thoughts on this!
Comment #7
mohit_aghera commentedNice observation!!
Thanks for pointing it out.
Comment #9
mohit_aghera commented