portal url fix

This commit is contained in:
Yuri Kuznetsov
2020-02-03 14:21:05 +02:00
parent d625647b29
commit 7cf512f75b
2 changed files with 19 additions and 1 deletions
+15 -1
View File
@@ -676,8 +676,22 @@ class User extends Record
$subjectTpl = $templateFileManager->getTemplate('passwordChangeLink', 'subject', 'User');
$bodyTpl = $templateFileManager->getTemplate('passwordChangeLink', 'body', 'User');
$siteUrl = $this->getConfig()->getSiteUrl();
if ($user->isPortal()) {
$portal = $this->getEntityManager()->getRepository('Portal')->distinct()->join('users')->where([
'isActive' => true,
'users.id' => $user->id,
])->findOne();
if ($portal) {
if ($portal->get('customUrl')) {
$siteUrl = $portal->get('customUrl');
}
}
}
$data = [];
$link = $this->getConfig()->getSiteUrl() . '?entryPoint=changePassword&id=' . $requestId;
$link = $siteUrl . '?entryPoint=changePassword&id=' . $requestId;
$data['link'] = $link;
$htmlizer = new \Espo\Core\Htmlizer\Htmlizer($this->getFileManager(), $this->getDateTime(), $this->getNumber(), null);
+4
View File
@@ -39,6 +39,10 @@ $requestUri = $url;
$portalId = explode('/', $url)[count(explode('/', $_SERVER['SCRIPT_NAME'])) - 1];
if (strpos($requestUri, '=') !== false) {
$portalId = null;
}
if (!isset($portalId)) {
$url = $_SERVER['REDIRECT_URL'];
$portalId = explode('/', $url)[count(explode('/', $_SERVER['SCRIPT_NAME'])) - 1];