From 20cefcfdd73e42392492cae10ee8353159faf278 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 19 Dec 2024 15:42:06 -0500 Subject: [PATCH] dev/core#5610 Simplifying the session cookie message to make it readable and less scary for average users --- CRM/Core/Controller.php | 6 +++--- CRM/Core/Page.php | 3 +-- templates/CRM/common/fatal.tpl | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 724c79227313..7e35029d1f4b 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -858,8 +858,8 @@ public function invalidKey() { } public function invalidKeyCommon() { - $msg = ts("We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.") . '

' . ts('Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.') . '

' . ts('Error type: Could not find a valid session key.'); - throw new CRM_Core_Exception($msg); + throw new CRM_Core_Exception( + ts("Sorry, your session has expired. Please reload the page or go back and try again."), 419, ts("Could not find valid session key.")); } /** @@ -875,7 +875,7 @@ public function invalidKeyRedirect() { if (!empty($url_parts['query'])) { $redirect_url .= '?' . $url_parts['query']; } - CRM_Core_Session::setStatus(ts('Your browser session has expired and we are unable to complete your form submission. We have returned you to the initial step so you can complete and resubmit the form. If you experience continued difficulties, please contact us for assistance.')); + CRM_Core_Session::setStatus(ts('Sorry, your session has expired. Please resubmit your information to complete your submission.')); return CRM_Utils_System::redirect($redirect_url); } } diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 89965a18a608..4ad14804e92d 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -574,8 +574,7 @@ public function addExpectedSmartyVariables(array $elementNames): void { } public function invalidKey() { - $msg = ts("We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.") . '

' . ts('Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.') . '

' . ts('Error type: Could not find a valid session key.'); - throw new CRM_Core_Exception($msg); + throw new CRM_Core_Exception(ts("Sorry, your session has expired. Please go back and try again."), 419, ts("Could not find valid session key.")); } } diff --git a/templates/CRM/common/fatal.tpl b/templates/CRM/common/fatal.tpl index 4312471324b4..81000e9d4232 100644 --- a/templates/CRM/common/fatal.tpl +++ b/templates/CRM/common/fatal.tpl @@ -33,7 +33,6 @@ {/if}
- {ts}Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.{/ts}
{$message|escape}
{if !empty($error.message) && $message != $error.message}