Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
add env name to mail data
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
wellingguzman committed Mar 28, 2018
1 parent c5a707e commit 2b07916
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/core/helpers/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ function send_email($viewPath, array $data, callable $callback)
call_user_func($callback, $message);

if ($message->getBody() === null) {
$content = parse_twig($viewPath, $data);
$content = parse_twig($viewPath, array_merge(
$data,
['api' => ['env' => get_api_env()]]
));
$message->setBody($content, 'text/html');
}

Expand Down
2 changes: 1 addition & 1 deletion src/mail/forgot-password.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<p>{{ t('You requested to reset your password, here is your reset password link:') }}</p>

{% set reset_url = settings.global.project_url|trim('/') ~ '/_/auth/reset_password/' ~ reset_token %}
{% set reset_url = settings.global.project_url|trim('/') ~ '/' ~ api.env ~ '/auth/reset_password/' ~ reset_token %}
<p><a href="{{ reset_url }}">{{ reset_url }}</a></p>

<p>{{ t('Love,') }}<br>Directus</p>
Expand Down
2 changes: 0 additions & 2 deletions src/mail/notification.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends "base.twig" %}
{% block content %}



&ldquo;{{ message }}&rdquo;<br><br>
<span style="color:#aaaaaa;">—{{ sender.first_name }} {{ sender.last_name }}</span><br>
<a href="{{ settings.global.project_url }}messages/{{ message_id }}" style="font-size:12px;letter-spacing:0.3px;font-style:italic;">View full message</a>
Expand Down
2 changes: 1 addition & 1 deletion src/mail/user-invitation.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<p>You have been invited to {{settings.global.project_name }}. Please click the link below to join:</p>

{% set invitation_url = settings.global.project_url|trim('/') ~ '/_/auth/invitation/' ~ token %}
{% set invitation_url = settings.global.project_url|trim('/') ~ '/' ~ api.env ~ '/auth/invitation/' ~ token %}
<p><a href="{{ invitation_url }}">{{ invitation_url }}</a></p>

<p>{{ t('Love,') }}<br>Directus</p>
Expand Down

0 comments on commit 2b07916

Please sign in to comment.