Skip to content

Commit

Permalink
Merge pull request #517 from atm-corentin/FIX_DA025506_UrlExternalAccess
Browse files Browse the repository at this point in the history
FIX - DA025506- Use External Access Portal URL in password reset email instead of Dol…
  • Loading branch information
atm-lucasmantegari authored Oct 1, 2024
2 parents fde37d8 + 84f7843 commit 90fe67e
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 90fe67e

Please sign in to comment.