From 84f78431d445a73972ed3979ec5770cf9267115a Mon Sep 17 00:00:00 2001 From: atm-corentin Date: Tue, 1 Oct 2024 12:00:21 +0200 Subject: [PATCH] Use External Access Portal URL in password reset email instead of Dolibarr URL --- htdocs/user/class/user.class.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 974196b1aac26..c454a5f699787 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2473,7 +2473,14 @@ public function send_password($user, $password = '', $changelater = 0) { // phpcs:enable global $conf, $langs, $mysoc; - global $dolibarr_main_url_root; + // ******************** + // spe Sheltercom DA025506 ticket + // ******************** +// global $dolibarr_main_url_root; + dol_include_once('/externalaccess/www/class/context.class.php'); + // ******************** + // spe Sheltercom DA025506 ticket + // ******************** require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -2503,8 +2510,16 @@ public function send_password($user, $password = '', $changelater = 0) $subject = '['.$appli.'] '.$outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + // ******************** + // spe Sheltercom DA025506 ticket + // ******************** +// $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +// $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $context = Context::getInstance(); + $urlwithroot = rtrim($context->getControllerUrl(), '/');; // This is to use external domain name found into config file + // ******************** + // spe Sheltercom DA025506 ticket + // ******************** if (!$changelater) { $url = $urlwithroot.'/';