Allow "destination" query parameter to override redirection

Created on 2 April 2024, 8 months ago
Updated 22 July 2024, 4 months ago

Problem/Motivation

Our client has a use case where users click a link to the site. Before they can access the link, they are redirected to log in to the Drupal site via the destination query parameter. Drupal redirects appropriately given this query parameter, but this module overrides that redirection.

I've added a checkbox to the configuration for user_redirect that allows the destination query parameter to take precedence over the user supplied redirection URL. If there is no destination query parameter, the URL provided by the user via this module is used instead.

Steps to reproduce

The steps will vary based on your permissions set up, but to test the new functionality provided in this patch:

  1. Visit the configuration page for this module: /admin/people/users/redirect/form/settings
  2. Fill in a redirection URL and check the box for "Destination query parameter override"
  3. When logged out, visit a URL to login with the query parameter, like /user/login?destination=/admin/content
  4. Log in and verify you are redirected to the destination in the query parameter, not the URL you supplied
  5. Now, change settings around and try with/without a destination query parameter

Proposed resolution

The patch provided adds configuration options for each user role and allows the destination query parameter to override a user-supplied URL.

Remaining tasks

User interface changes

A checkbox appears on the form to allow the user to override the functionality.

API changes

Data model changes

The checkbox is stored in configuration alongside the URL.

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States patrickfweston Columbus, Ohio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024