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

Command icon 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

    Supreetam09 created an issue. See original summary.

    supreetam09’s picture

    Here is the patch to fix.

    mohit_aghera’s picture

    You 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.

    supreetam09’s picture

    Here is the patch against 1.x branch.

    mohit_aghera’s picture

    Status: Active » Needs work
    +++ b/src/EventSubscriber/RestrictRoleLoginByIpEventSubscriber.php
    @@ -33,14 +35,15 @@ class RestrictRoleLoginByIpEventSubscriber implements EventSubscriberInterface {
    +  public function onKernelRequest(GetResponseEvent $event) {
    

    I 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...

    supreetam09’s picture

    Symfony\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!

    mohit_aghera’s picture

    Status: Needs work » Reviewed & tested by the community

    Nice observation!!
    Thanks for pointing it out.

    mohit_aghera’s picture

    Status: Reviewed & tested by the community » Fixed

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.