fix: hotfix for redirect param in custom templates (#7437)
* fix: hotfix for redirect param in custom templates * fix: redirect param variables * fix: variable typo * chore: update comments for template variables
This commit is contained in:
parent
a2d97b3b22
commit
78f7b1897e
3 changed files with 10 additions and 9 deletions
|
@ -1011,7 +1011,6 @@ App::post('/v1/account/sessions/magic-url')
|
|||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-inner-base.tpl');
|
||||
$message
|
||||
->setParam('{{body}}', $body, escapeHtml: false)
|
||||
->setParam('{{redirect}}', $url, escapeHtml: false)
|
||||
->setParam('{{hello}}', $locale->getText("emails.magicSession.hello"))
|
||||
->setParam('{{footer}}', $locale->getText("emails.magicSession.footer"))
|
||||
->setParam('{{thanks}}', $locale->getText("emails.magicSession.thanks"))
|
||||
|
@ -1066,9 +1065,10 @@ App::post('/v1/account/sessions/magic-url')
|
|||
|
||||
$emailVariables = [
|
||||
'direction' => $locale->getText('settings.direction'),
|
||||
/* {{user}} ,{{team}} and {{project}} are required in the templates */
|
||||
/* {{user}}, {{team}}, {{redirect}} and {{project}} are required in default and custom templates */
|
||||
'user' => '',
|
||||
'team' => '',
|
||||
'redirect' => $url,
|
||||
'project' => $project->getAttribute('name')
|
||||
];
|
||||
|
||||
|
@ -2456,7 +2456,6 @@ App::post('/v1/account/recovery')
|
|||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-inner-base.tpl');
|
||||
$message
|
||||
->setParam('{{body}}', $body, escapeHtml: false)
|
||||
->setParam('{{redirect}}', $url, escapeHtml: false)
|
||||
->setParam('{{hello}}', $locale->getText("emails.recovery.hello"))
|
||||
->setParam('{{footer}}', $locale->getText("emails.recovery.footer"))
|
||||
->setParam('{{thanks}}', $locale->getText("emails.recovery.thanks"))
|
||||
|
@ -2511,9 +2510,10 @@ App::post('/v1/account/recovery')
|
|||
|
||||
$emailVariables = [
|
||||
'direction' => $locale->getText('settings.direction'),
|
||||
/* {{user}} ,{{team}} and {{project}} are required in the templates */
|
||||
/* {{user}}, {{team}}, {{redirect}} and {{project}} are required in default and custom templates */
|
||||
'user' => $profile->getAttribute('name'),
|
||||
'team' => '',
|
||||
'redirect' => $url,
|
||||
'project' => $projectName
|
||||
];
|
||||
|
||||
|
@ -2708,7 +2708,6 @@ App::post('/v1/account/verification')
|
|||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-inner-base.tpl');
|
||||
$message
|
||||
->setParam('{{body}}', $body, escapeHtml: false)
|
||||
->setParam('{{redirect}}', $url, escapeHtml: false)
|
||||
->setParam('{{hello}}', $locale->getText("emails.verification.hello"))
|
||||
->setParam('{{footer}}', $locale->getText("emails.verification.footer"))
|
||||
->setParam('{{thanks}}', $locale->getText("emails.verification.thanks"))
|
||||
|
@ -2763,9 +2762,10 @@ App::post('/v1/account/verification')
|
|||
|
||||
$emailVariables = [
|
||||
'direction' => $locale->getText('settings.direction'),
|
||||
/* {{user}} ,{{team}} and {{project}} are required in the templates */
|
||||
/* {{user}}, {{team}}, {{redirect}} and {{project}} are required in default and custom templates */
|
||||
'user' => $user->getAttribute('name'),
|
||||
'team' => '',
|
||||
'redirect' => $url,
|
||||
'project' => $projectName
|
||||
];
|
||||
|
||||
|
|
|
@ -557,7 +557,6 @@ App::post('/v1/teams/:teamId/memberships')
|
|||
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-inner-base.tpl');
|
||||
$message
|
||||
->setParam('{{body}}', $body, escapeHtml: false)
|
||||
->setParam('{{redirect}}', $url, escapeHtml: false)
|
||||
->setParam('{{hello}}', $locale->getText("emails.invitation.hello"))
|
||||
->setParam('{{footer}}', $locale->getText("emails.invitation.footer"))
|
||||
->setParam('{{thanks}}', $locale->getText("emails.invitation.thanks"))
|
||||
|
@ -613,9 +612,10 @@ App::post('/v1/teams/:teamId/memberships')
|
|||
$emailVariables = [
|
||||
'owner' => $user->getAttribute('name'),
|
||||
'direction' => $locale->getText('settings.direction'),
|
||||
/* {{user}} ,{{team}} and {{project}} are required in the templates */
|
||||
/* {{user}}, {{team}}, {{redirect}} and {{project}} are required in default and custom templates */
|
||||
'user' => $user->getAttribute('name'),
|
||||
'team' => $team->getAttribute('name'),
|
||||
'redirect' => $url,
|
||||
'project' => $projectName
|
||||
];
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ class Mails extends Action
|
|||
$bodyTemplate = Template::fromFile($bodyTemplate);
|
||||
$bodyTemplate->setParam('{{body}}', $body, escapeHtml: false);
|
||||
foreach ($variables as $key => $value) {
|
||||
$bodyTemplate->setParam('{{' . $key . '}}', $value);
|
||||
// TODO: hotfix for redirect param
|
||||
$bodyTemplate->setParam('{{' . $key . '}}', $value, escapeHtml: $key !== 'redirect');
|
||||
}
|
||||
$body = $bodyTemplate->render();
|
||||
|
||||
|
|
Loading…
Reference in a new issue