HTML code appears in the error message when a new user attempts to register without agreeing to the required Data Policy checkbox.

Created on 25 January 2025, 3 months ago

Problem/Motivation

  • When a new user attempts to register without agreeing to the required Data Policy checkbox, an error message is displayed. However, this error message includes raw HTML code, making it unreadable for end users.
  • Additionally, the existing logic only handles URLs in the form of /register and fails when the URL includes parameters (e.g., /register?destination=/node/xxxx).
  • This results in a poor user experience and inconsistent handling of error messages.

Steps to reproduce

  1. Navigate to the registration page with a query parameter in the URL, e.g., /register?destination=/node/xxxx.
  1. Attempt to register without agreeing to the Data Policy checkbox.
  1. Observe the error message displayed on the page. It includes raw HTML code, which is confusing for end users.

Proposed resolution

  • Refactor the data_policy_preprocess_status_messages() function to handle URLs with parameters (e.g., /register?destination=/node/xxxx) as well as anchor links.
  • Use preg_match() to ensure robust matching of the error message links and decode any HTML entities before rendering the error messages.

Remaining tasks

  1. Update the regex in data_policy_preprocess_status_messages() to handle additional URL formats.
  1. Test the updated implementation with various URL formats, including:
  • /register
  • /register?destination=/node/xxxx
  • URLs with additional query parameters.
  1. Confirm that the error message no longer contains raw HTML and is rendered correctly.
  1. Submit a patch for review.

User interface changes

  • Error messages on the registration page will now display as plain text, free of raw HTML, providing a better user experience.

API changes

  • No API changes are introduced.

Data model changes

  • No changes to the data model are required.
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇱🇰Sri Lanka SajithAthukorala

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