Skip to content

Commit

Permalink
Use External Access Portal URL in password reset email instead of Dol…
Browse files Browse the repository at this point in the history
…ibarr URL
  • Loading branch information
atm-corentin committed Oct 1, 2024
1 parent fde37d8 commit 84f7843
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions htdocs/user/class/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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.'/';
Expand Down

0 comments on commit 84f7843

Please sign in to comment.