diff --git a/src/bundle/Controller/PasswordResetController.php b/src/bundle/Controller/PasswordResetController.php
index 01edfdac..6135aef8 100644
--- a/src/bundle/Controller/PasswordResetController.php
+++ b/src/bundle/Controller/PasswordResetController.php
@@ -31,6 +31,7 @@
use Ibexa\User\View\ResetPassword\FormView as UserResetPasswordFormView;
use Ibexa\User\View\ResetPassword\InvalidLinkView;
use Ibexa\User\View\ResetPassword\SuccessView as UserResetPasswordSuccessView;
+use Swift_Image;
use Swift_Mailer;
use Swift_Message;
use Symfony\Component\HttpFoundation\Request;
@@ -82,6 +83,7 @@ public function __construct(
*/
public function userForgotPasswordAction(Request $request, ?string $reason = null)
{
+
$form = $this->formFactory->forgotUserPassword();
$form->handleRequest($request);
@@ -249,12 +251,19 @@ private function sendResetPasswordMessage(User $user, string $hashKey): void
$subject = $template->renderBlock('subject', []);
$from = $template->renderBlock('from', []) ?: $senderAddress;
- $body = $template->renderBlock('body', ['hash_key' => $hashKey]);
$message = (new Swift_Message())
->setSubject($subject)
- ->setTo($user->email)
- ->setBody($body, 'text/html');
+ ->setTo($user->email);
+
+ $mailImagesDir = dirname(__DIR__, 6) . '/public/bundles/ibexaadminui/img/mail/';
+ $embeddedHeader = $message->embed(Swift_Image::fromPath($mailImagesDir . 'header.png'));
+
+ $body = $template->renderBlock('body', [
+ 'hash_key' => $hashKey,
+ 'header_img_path' => $embeddedHeader,
+ ]);
+ $message->setBody($body, 'text/html');
if (empty($from) === false) {
$message->setFrom($from);
diff --git a/src/bundle/Resources/translations/ibexa_forgot_password.en.xliff b/src/bundle/Resources/translations/ibexa_forgot_password.en.xliff
index a42560e0..1897b22b 100644
--- a/src/bundle/Resources/translations/ibexa_forgot_password.en.xliff
+++ b/src/bundle/Resources/translations/ibexa_forgot_password.en.xliff
@@ -16,23 +16,6 @@
If you reset your password multiple times, only the most recent password reset link will be valid.
- We have received a request to reset the password for your account. Click “reset password” below to choose a new password:
-
- Reset password
-
- If you did not request a password reset, please ignore this email, and your password will remain the same.]]>
- We have received a request to reset the password for your account. Click “reset password” below to choose a new password:
-
- Reset password
-
- If you did not request a password reset, please ignore this email, and your password will remain the same.]]>
- {{ 'ezplatform.forgot_password.message'|trans({ '%reset_password%': url('ibexa.user.reset_password', {'hashKey': hash_key}) })|raw
- |desc('Hello,
-
- We have received a request to reset the password for your account. Click “reset password” below to choose a new password:
-
- Reset password
-
- If you did not request a password reset, please ignore this email, and your password will remain the same.') }}
-
- {{ 'ibexa.user.invitation.mail.message'|trans({ - '%invite_link%': url('ibexa.user.from_invite.register', { - 'inviteHash': invite_hash, - 'siteaccess': siteaccess - }) - })|raw - |desc('Hello, - Join us at: %invite_link% - ') }} -
-{%- endblock body -%} +{%- block mail_message_title_content -%} + {{ 'ibexa.user.invitation.mail.message_title'|trans()|desc('Hello,') }} +{%- endblock mail_message_title_content -%} + +{%- block mail_message_content -%} + {{ 'ibexa.user.invitation.mail.message'|trans()|desc('Join us at:') }} +{%- endblock mail_message_content -%} + +{%- block mail_actions_conten -%} + {% include '@ibexadesign/ui/mail/action_btn.html.twig' with { + url: url('ibexa.user.from_invite.register', { + 'inviteHash': invite_hash, + 'siteaccess': siteaccess + }), + label: 'ibexa.user.invitation.mail.join'|trans()|desc('Join') + } %} +{%- endblock mail_actions_conten -%} + +{%- block mail_footer -%}{%- endblock mail_footer -%} diff --git a/src/lib/Invitation/MailSender.php b/src/lib/Invitation/MailSender.php index 2714ea60..ed5e4afd 100644 --- a/src/lib/Invitation/MailSender.php +++ b/src/lib/Invitation/MailSender.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\User\Invitation\InvitationSender; use Swift_Mailer; use Swift_Message; +use Swift_Image; use Twig\Environment; final class MailSender implements InvitationSender @@ -49,16 +50,26 @@ public function sendInvitation(Invitation $invitation): void $subject = $template->renderBlock('subject', []); $from = $template->renderBlock('from', []) ?: $senderAddress; + + $message = (new Swift_Message()) + ->setSubject($subject) + ->setTo($invitation->getEmail()); + + $mailImagesDir = dirname(__DIR__, 6) . '/public/bundles/ibexaadminui/img/mail/'; + $embeddedHeader = $message->embed(Swift_Image::fromPath($mailImagesDir . 'header.jpg')); + $embeddedBtnPrimaryLeftSide = $message->embed(Swift_Image::fromPath($mailImagesDir .'btn_primary_left_side.jpg')); + $embeddedBtnPrimaryRightSide = $message->embed(Swift_Image::fromPath($mailImagesDir .'btn_primary_right_side.jpg')); + $body = $template->renderBlock('body', [ 'invite_hash' => $invitation->getHash(), 'siteaccess' => $invitation->getSiteAccessIdentifier(), 'invitation' => $invitation, + 'header_path' => $embeddedHeader, + 'btn_primary_left_side' => $embeddedBtnPrimaryLeftSide, + 'btn_primary_right_side' => $embeddedBtnPrimaryRightSide, ]); - $message = (new Swift_Message()) - ->setSubject($subject) - ->setTo($invitation->getEmail()) - ->setBody($body, 'text/html'); + $message->setBody($body, 'text/html'); if (empty($from) === false) { $message->setFrom($from);