The Module every Drupal App developer needs


DRTL – Redirect 403 to User Login


We have an internal app where all pages require a log in. By default Drupal shows an Access Denied page which confuses the staff. I had attempted several times to find a module to show a login page and redirect the user once logged in successfully but with no luck.

One suggestion was to replace the 403 access denied page with the log in page

/admin/config/system/site-information


However, when staff logged in the “Access Denied” message remained because they are redirected to the wrong page.


Redirect 403 to User Login

Finally I found a module for that! Redirect 403 to User Login. Simply install and its good to go.

Now users see a “Access Denied” message with a login screen. Once they have logged in they are taken to the page they were trying to access.


 


Continuous Integration (CI) Tests

There was a snag when running my automated tests. It expected 403 errors from certain pages but the module would return 200 ok status. I tweaked my tests to look for the “Access Denied” text instead. In other cases it was more useful to configure the module to exclude certain endpoints.

/admin/config/system/r4032login/settings


 

Comments

Popular posts from this blog

Insights for Software Development Workflows from the Pacific Islands

Government of Tonga’s first mobile app nears completion

Bot Busters: Defending Your Site Against Bots