From 682b0ae67b660c00621cd8961baa61fe42b6cff0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?=
Date: Tue, 29 Apr 2025 09:12:59 +0000
Subject: [PATCH] Fix FLEXIAPI-287 Refactor the emails templates
---
CHANGELOG.md | 1 +
flexiapi/app/Account.php | 5 ++
.../Admin/ProvisioningEmailController.php | 3 +-
.../Admin/ResetPasswordEmailController.php | 2 +-
flexiapi/app/Http/Middleware/SpaceCheck.php | 2 +-
flexiapi/app/Mail/ConfirmedRegistration.php | 36 +++++++----
flexiapi/app/Mail/NewsletterRegistration.php | 36 +++++++----
flexiapi/app/Mail/Provisioning.php | 64 +++++++++++--------
flexiapi/app/Mail/RecoverByCode.php | 53 +++++++--------
flexiapi/app/Mail/RegisterValidation.php | 38 ++++++-----
flexiapi/app/Mail/ResetPassword.php | 38 ++++++-----
flexiapi/lang/fr.json | 15 +++--
.../views/admin/account/show.blade.php | 5 ++
.../views/mails/authentication.blade.php | 30 ---------
.../authentication_custom.blade.php.example | 25 --------
.../views/mails/authentication_text.blade.php | 17 -----
...thentication_text_custom.blade.php.example | 13 ----
.../mails/confirmed_registration.blade.php | 56 ++++++++--------
.../confirmed_registration_text.blade.php | 26 --------
.../resources/views/mails/layout.blade.php | 14 ++++
.../mails/newsletter_registration.blade.php | 18 ++----
.../newsletter_registration_text.blade.php | 3 -
.../views/mails/parts/provisioning.blade.php | 9 +++
.../views/mails/provisioning.blade.php | 25 ++------
.../provisioning_custom.blade.php.example | 26 +++-----
.../views/mails/provisioning_text.blade.php | 10 ---
...provisioning_text_custom.blade.php.example | 10 ---
.../views/mails/recover_by_code.blade.php | 20 ++++++
.../recover_by_code_custom.blade.php.example | 20 ++++++
.../views/mails/register_validate.blade.php | 19 ------
.../mails/register_validate_text.blade.php | 10 ---
.../views/mails/register_validation.blade.php | 13 ++++
.../views/mails/reset_password.blade.php | 36 +++++------
.../views/mails/reset_password_text.blade.php | 10 ---
.../views/vendor/mail/html/button.blade.php | 13 ++--
.../views/vendor/mail/html/header.blade.php | 1 +
.../views/vendor/mail/html/layout.blade.php | 9 ++-
.../views/vendor/mail/html/message.blade.php | 32 +++++-----
.../views/vendor/mail/html/table.blade.php | 2 +-
.../views/vendor/mail/html/themes/default.css | 28 ++++----
.../views/vendor/mail/text/header.blade.php | 2 +-
.../views/vendor/mail/text/layout.blade.php | 4 +-
.../views/vendor/mail/text/message.blade.php | 32 +++++-----
43 files changed, 381 insertions(+), 450 deletions(-)
delete mode 100644 flexiapi/resources/views/mails/authentication.blade.php
delete mode 100644 flexiapi/resources/views/mails/authentication_custom.blade.php.example
delete mode 100644 flexiapi/resources/views/mails/authentication_text.blade.php
delete mode 100644 flexiapi/resources/views/mails/authentication_text_custom.blade.php.example
delete mode 100644 flexiapi/resources/views/mails/confirmed_registration_text.blade.php
create mode 100644 flexiapi/resources/views/mails/layout.blade.php
delete mode 100644 flexiapi/resources/views/mails/newsletter_registration_text.blade.php
create mode 100644 flexiapi/resources/views/mails/parts/provisioning.blade.php
delete mode 100644 flexiapi/resources/views/mails/provisioning_text.blade.php
delete mode 100644 flexiapi/resources/views/mails/provisioning_text_custom.blade.php.example
create mode 100644 flexiapi/resources/views/mails/recover_by_code.blade.php
create mode 100644 flexiapi/resources/views/mails/recover_by_code_custom.blade.php.example
delete mode 100644 flexiapi/resources/views/mails/register_validate.blade.php
delete mode 100644 flexiapi/resources/views/mails/register_validate_text.blade.php
create mode 100644 flexiapi/resources/views/mails/register_validation.blade.php
delete mode 100644 flexiapi/resources/views/mails/reset_password_text.blade.php
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29b7c36..ae6fd79 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ v1.7
- Fix FLEXIAPI-272 Add Space based email server integration
- Fix FLEXIAPI-284 Add configurable admin API Keys
- Fix FLEXIAPI-232 Add provisioning email + important redesign of the contacts page
+- Fix FLEXIAPI-287 Refactor the emails templates
v1.6
----
diff --git a/flexiapi/app/Account.php b/flexiapi/app/Account.php
index c454fd7..67b41a2 100644
--- a/flexiapi/app/Account.php
+++ b/flexiapi/app/Account.php
@@ -261,6 +261,11 @@ class Account extends Authenticatable
return $this->hasMany(AuthToken::class);
}
+ public function currentResetPasswordEmailToken()
+ {
+ return $this->hasOne(ResetPasswordEmailToken::class)->where('used', false)->latestOfMany();
+ }
+
public function resetPasswordEmailTokens()
{
return $this->hasMany(ResetPasswordEmailToken::class)->latest();
diff --git a/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php b/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php
index 7fe0423..f7b2aa9 100644
--- a/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php
+++ b/flexiapi/app/Http/Controllers/Admin/ProvisioningEmailController.php
@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Admin;
use App\Account;
-use App\ResetPasswordEmailToken;
use App\Http\Controllers\Controller;
use App\Mail\Provisioning;
@@ -23,7 +22,7 @@ class ProvisioningEmailController extends Controller
]);
}
- public function send(int $accountId)
+ public function send(Request $request, int $accountId)
{
$account = Account::findOrFail($accountId);
$account->provision();
diff --git a/flexiapi/app/Http/Controllers/Admin/ResetPasswordEmailController.php b/flexiapi/app/Http/Controllers/Admin/ResetPasswordEmailController.php
index 953f7d0..4133721 100644
--- a/flexiapi/app/Http/Controllers/Admin/ResetPasswordEmailController.php
+++ b/flexiapi/app/Http/Controllers/Admin/ResetPasswordEmailController.php
@@ -32,7 +32,7 @@ class ResetPasswordEmailController extends Controller
$resetPasswordEmail->email = $account->email;
$resetPasswordEmail->save();
- Mail::to($account)->send(new ResetPassword($resetPasswordEmail));
+ Mail::to($account)->send(new ResetPassword($account));
return redirect()->route('admin.account.activity.index', $account);
}
diff --git a/flexiapi/app/Http/Middleware/SpaceCheck.php b/flexiapi/app/Http/Middleware/SpaceCheck.php
index 6f3e3a9..3bb9feb 100644
--- a/flexiapi/app/Http/Middleware/SpaceCheck.php
+++ b/flexiapi/app/Http/Middleware/SpaceCheck.php
@@ -43,7 +43,7 @@ class SpaceCheck
'username' => $space->emailServer->username,
'password' => $space->emailServer->password,
'signature' => $space->emailServer->signature ?? config('mail.signature')
- ];
+ ] + Config::get('mail');
Config::set('mail', $config);
}
diff --git a/flexiapi/app/Mail/ConfirmedRegistration.php b/flexiapi/app/Mail/ConfirmedRegistration.php
index a883419..7fc6120 100644
--- a/flexiapi/app/Mail/ConfirmedRegistration.php
+++ b/flexiapi/app/Mail/ConfirmedRegistration.php
@@ -1,7 +1,7 @@
account = $account;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view('mails.confirmed_registration')
- ->text('mails.confirmed_registration_text')
- ->with(['account' => $this->account]);
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Registration confirmed'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: 'mails.confirmed_registration',
+ );
}
}
diff --git a/flexiapi/app/Mail/NewsletterRegistration.php b/flexiapi/app/Mail/NewsletterRegistration.php
index 5176984..f12eca1 100644
--- a/flexiapi/app/Mail/NewsletterRegistration.php
+++ b/flexiapi/app/Mail/NewsletterRegistration.php
@@ -1,7 +1,7 @@
account = $account;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view('mails.newsletter_registration')
- ->text('mails.newsletter_registration_text')
- ->with(['account' => $this->account]);
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Newsletter registration confirmed'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: 'mails.newsletter_registration',
+ );
}
}
diff --git a/flexiapi/app/Mail/Provisioning.php b/flexiapi/app/Mail/Provisioning.php
index 85cc247..924e615 100644
--- a/flexiapi/app/Mail/Provisioning.php
+++ b/flexiapi/app/Mail/Provisioning.php
@@ -1,41 +1,55 @@
.
+*/
namespace App\Mail;
-use Illuminate\Bus\Queueable;
-use Illuminate\Mail\Mailable;
-use Illuminate\Queue\SerializesModels;
-
use App\Account;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Mail\Mailable;
+use Illuminate\Mail\Mailables\Content;
+use Illuminate\Mail\Mailables\Envelope;
+use Illuminate\Queue\SerializesModels;
+
class Provisioning extends Mailable
{
use Queueable, SerializesModels;
- private $account;
-
- public function __construct(Account $account)
- {
- $this->account = $account;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view(view()->exists('mails.provisioning_custom')
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Provisioning of your device'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: view()->exists('mails.provisioning_custom')
? 'mails.provisioning_custom'
- : 'mails.provisioning')
- ->text(view()->exists('mails.provisioning_text_custom')
- ? 'mails.provisioning_text_custom'
- : 'mails.provisioning_text')
- ->with([
- 'provisioning_link' => route('provisioning.provision', [
- 'provisioning_token' => $this->account->provisioning_token,
- 'reset_password' => true
- ]),
- 'provisioning_qrcode' => route('provisioning.qrcode', [
- 'provisioning_token' => $this->account->provisioning_token,
- 'reset_password' => true
- ])
- ]);
+ : 'mails.provisioning',
+ );
}
}
diff --git a/flexiapi/app/Mail/RecoverByCode.php b/flexiapi/app/Mail/RecoverByCode.php
index 116d2c3..1a371a7 100644
--- a/flexiapi/app/Mail/RecoverByCode.php
+++ b/flexiapi/app/Mail/RecoverByCode.php
@@ -1,7 +1,7 @@
account = $account;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view(view()->exists('mails.authentication_custom')
- ? 'mails.authentication_custom'
- : 'mails.authentication')
- ->text(view()->exists('mails.authentication_text_custom')
- ? 'mails.authentication_text_custom'
- : 'mails.authentication_text')
- ->with([
- 'expiration_minutes' => config('app.recovery_code_expiration_minutes'),
- 'recovery_code' => $this->account->recovery_code,
- 'provisioning_link' => route('provisioning.provision', [
- 'provisioning_token' => $this->account->provisioning_token,
- 'reset_password' => true
- ]),
- 'provisioning_qrcode' => route('provisioning.qrcode', [
- 'provisioning_token' => $this->account->provisioning_token,
- 'reset_password' => true
- ])
- ]);
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Account recovery'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: view()->exists('mails.recover_by_code_custom')
+ ? 'mails.recover_by_code_custom'
+ : 'mails.recover_by_code',
+ );
}
}
diff --git a/flexiapi/app/Mail/RegisterValidation.php b/flexiapi/app/Mail/RegisterValidation.php
index 8ba4227..a180c18 100644
--- a/flexiapi/app/Mail/RegisterValidation.php
+++ b/flexiapi/app/Mail/RegisterValidation.php
@@ -1,7 +1,7 @@
account = $account;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view('mails.register_validate')
- ->text('mails.register_validate_text')
- ->with([
- 'code' => $this->account->emailChangeCode()->first()->code
- ]);
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Account registered'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: 'mails.register_validation',
+ );
}
}
diff --git a/flexiapi/app/Mail/ResetPassword.php b/flexiapi/app/Mail/ResetPassword.php
index c68110d..4abc43a 100644
--- a/flexiapi/app/Mail/ResetPassword.php
+++ b/flexiapi/app/Mail/ResetPassword.php
@@ -1,7 +1,7 @@
token = $token;
+ public function __construct(
+ public Account $account
+ ) {
}
- public function build()
+ public function envelope(): Envelope
{
- return $this->view('mails.reset_password')
- ->text('mails.reset_password')
- ->with([
- 'token' => $this->token
- ]);
+ return new Envelope(
+ subject: $this->account->space->name . ': '. __('Reset your password'),
+ );
+ }
+
+ public function content(): Content
+ {
+ return new Content(
+ markdown: 'mails.reset_password',
+ );
}
}
diff --git a/flexiapi/lang/fr.json b/flexiapi/lang/fr.json
index 92ecb23..b4fd6e8 100644
--- a/flexiapi/lang/fr.json
+++ b/flexiapi/lang/fr.json
@@ -5,6 +5,7 @@
"Account creation": "Création de compte",
"Account recovered recently, try again later": "Tentative de récupération de compte récente, retentez ultérieurement",
"Account recovery": "Récupération de compte",
+ "Account registered": "Compte créé",
"Account settings": "Paramètres de compte",
"Account": "Compte",
"Accounts": "Comptes",
@@ -22,9 +23,9 @@
"Administration": "Administration",
"All the admins will be super admins": "Tous les administrateurs seront super-administrateurs",
"Allow a custom CSS theme": "Autoriser un thème CSS personnalisé",
- "Allow client settings to be overwritten by the provisioning ones": "Écraser la configuration client avec celle du provisionnement",
+ "Allow client settings to be overwritten by the provisioning ones": "Écraser la configuration client avec celle du déploiement",
"An email will be sent to :email with a unique link allowing the user to reset its password.": "Un email sera envoyé à :email avec un lien unique l'invitant à réinitialiser son mot de passe",
- "An email will be sent to :email with a QR Code and provisioning link.": "Un email sera envoyé à :email contenant un QR Code et un lien de provisionnement.",
+ "An email will be sent to :email with a QR Code and provisioning link.": "Un email sera envoyé à :email contenant un QR Code et un lien de déploiement.",
"An email will be sent to this email when someone join the newsletter": "Un email sera envoyé à cette addresse quand quelqu'un rejoint la liste de diffusion",
"App Configuration": "Configuration de l'App",
"Api Keys": "Clefs d'API",
@@ -115,6 +116,7 @@
"Never expire": "N'expire jamais",
"New Admin": "Nouvel Admin",
"Newsletter registration email address": "Addresse email d'inscription à la liste de diffusion",
+ "Newsletter registration confirmed": "Confirmation de l'inscription à la newsletter",
"Next": "Suivant",
"No account yet?": "Pas encore de compte ?",
"No email yet": "Pas d'email pour le moment",
@@ -131,8 +133,9 @@
"Please enter the new email that you would like to link to your account.": "Veuillez entre l'adresse email que vous souhaitez lier à votre compte.",
"Please enter the new phone number that you would like to link to your account.": "Veuillez entrer le numéro de téléphone que vous souhaitez lier à votre compte.",
"Protocol": "Protocole",
- "Provisioning tokens": "Jetons de provisionnement",
- "Provisioning": "Provisionnement",
+ "Provisioning tokens": "Jetons de déploiement",
+ "Provisioning": "Déploiement",
+ "Provisioning of your device": "Déploiement sur votre appareil",
"Public registration": "Inscription publiques",
"QR Code scanning": "Scan de QR Code",
"Realm": "Royaume",
@@ -142,12 +145,14 @@
"Register": "Inscription",
"Registrar": "Registrar",
"Registration introduction": "Présentation lors de l'inscription",
+ "Registration confirmed": "Confirmation de l'inscription",
"Remove": "Remove",
"Renew": "Renouveller",
"Requests": "Requêtes",
"Resend": "Ré-envoyer",
"Reset password emails": "Email de réinitialisation de mot de passe",
"Reset password": "Réinitialiser le mot de passe",
+ "Reset your password": "Réinitialiser votre mot de passe",
"Reset": "Réinitialiser",
"Role": "Rôle",
"Scan the following QR Code using an authenticated device and wait a few seconds.": "Scanner le QR Code avec un appareil authentifié et attendez quelques secondes",
@@ -156,7 +161,7 @@
"Select a domain": "Sélectionner un domaine",
"Select a file": "Choisir un fichier",
"Send an email to the user to reset the password": "Envoyer un email à l'utilisateur pour réinitialiser son mot de passe",
- "Send an email to the user with provisioning information": "Envoyer un email à l'utilisateur avec les informations de provisionnement",
+ "Send an email to the user with provisioning information": "Envoyer un email à l'utilisateur avec les informations de déploiement",
"Send": "Envoyer",
"Settings": "Paramètres",
"Sip Adress": "Adresse SIP",
diff --git a/flexiapi/resources/views/admin/account/show.blade.php b/flexiapi/resources/views/admin/account/show.blade.php
index 93a534d..2aac800 100644
--- a/flexiapi/resources/views/admin/account/show.blade.php
+++ b/flexiapi/resources/views/admin/account/show.blade.php
@@ -34,6 +34,11 @@
@if ($account->passwords()->count() > 0)
password {{ __('Password') }}: **********
@endif
+
+
+ globe-hemisphere-west
+ {{ __('Space') }}: {{ $account->domain }}
+
@include('admin.account.parts.badges', ['account' => $account])
diff --git a/flexiapi/resources/views/mails/authentication.blade.php b/flexiapi/resources/views/mails/authentication.blade.php
deleted file mode 100644
index ebbebb3..0000000
--- a/flexiapi/resources/views/mails/authentication.blade.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
- Authenticate on {{ space()->name }}
-
-
- Hello,
-
- You are trying to authenticate to {{ space()->name }} using your email account.
- Please enter the code bellow to finish the authentication process.
-
-
-
{{ $recovery_code }}
-
- @if ($expiration_minutes > 0)
-
- The code is only available {{ $expiration_minutes }} minutes.
-
- @endif
-
- You can as well configure your new device using the following code or by directly flashing the QRCode:
-
- 
- Provisioning link
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/authentication_custom.blade.php.example b/flexiapi/resources/views/mails/authentication_custom.blade.php.example
deleted file mode 100644
index 6be41db..0000000
--- a/flexiapi/resources/views/mails/authentication_custom.blade.php.example
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- Authenticate on {{ space()->name }}
-
-
- Hello,
-
- You are trying to authenticate to {{ space()->name }} using your email account.
- Please enter the code bellow to finish the authentication process.
-
-
-
{{ $recovery_code }}
-
-
- You can as well configure your new device using the following code or by directly flashing the QRCode:
-
- 
- Provisioning link
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/authentication_text.blade.php b/flexiapi/resources/views/mails/authentication_text.blade.php
deleted file mode 100644
index cb198b3..0000000
--- a/flexiapi/resources/views/mails/authentication_text.blade.php
+++ /dev/null
@@ -1,17 +0,0 @@
-Hello,
-
-You are trying to authenticate to {{ space()->name }} using your email account.
-Please enter the code bellow to finish the authentication process.
-
-{{ $recovery_code }}
-
-@if ($expiration_minutes > 0)
-The code is only available {{ $expiration_minutes }} minutes.
-@endif
-
-You can as well configure your new device using the following code or by directly flashing the QRCode in the following link:
-
-{{ $provisioning_qrcode}}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/authentication_text_custom.blade.php.example b/flexiapi/resources/views/mails/authentication_text_custom.blade.php.example
deleted file mode 100644
index d1b47f0..0000000
--- a/flexiapi/resources/views/mails/authentication_text_custom.blade.php.example
+++ /dev/null
@@ -1,13 +0,0 @@
-Hello,
-
-You are trying to authenticate to {{ space()->name }} using your email account.
-Please enter the code bellow to finish the authentication process.
-
-{{ $recovery_code }}
-
-You can as well configure your new device using the following code or by directly flashing the QRCode in the following link:
-
-{{ $provisioning_qrcode}}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/confirmed_registration.blade.php b/flexiapi/resources/views/mails/confirmed_registration.blade.php
index 00f35bd..f8d06c9 100644
--- a/flexiapi/resources/views/mails/confirmed_registration.blade.php
+++ b/flexiapi/resources/views/mails/confirmed_registration.blade.php
@@ -1,32 +1,26 @@
-
-
- Registration confirmed {{ space()->name }}
-
-
- Hello,
-
- @if (space()->confirmed_registration_text)
- {{ strip_tags(parsedown(space()->confirmed_registration_text)) }}
- @else
- Your SIP account has been successfully created.
- You can now configure this account on any SIP-compatible application using the following parameters:
-
- @endif
+@extends('mails.layout')
- SIP address: sip:{{ $account->identifier }}
- Username: {{ $account->username }}
- Domain: {{ $account->domain }}
-
- @if (!empty(space()?->account_proxy_registrar_address))
- Proxy/registrar address: sip:{{ space()?->account_proxy_registrar_address }}
- @endif
- @if (!empty(config('app.transport_protocol_text')))
- Transport: {{ config('app.transport_protocol_text') }}
- @endif
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
+@section('content')
+# Welcome to {{ $account->space->name }}
+
+Hello {{ $account->identifier }},
+
+@if ($account->space->confirmed_registration_text)
+{{ strip_tags(parsedown($account->space->confirmed_registration_text)) }}
+@else
+Your SIP account has been successfully created.
+
+You can now configure this account on any SIP-compatible application using the following parameters:
+@endif
+
+* SIP address: sip:{{ $account->identifier }}
+* Username: {{ $account->username }}
+* Domain: {{ $account->domain }}
+@if (!empty($account->space->account_proxy_registrar_address))
+* Proxy/registrar address: sip:{{ $account->space->account_proxy_registrar_address }}
+@endif
+@if (!empty(config('app.transport_protocol_text')))
+* Transport: {{ config('app.transport_protocol_text') }}
+@endif
+
+@endsection
diff --git a/flexiapi/resources/views/mails/confirmed_registration_text.blade.php b/flexiapi/resources/views/mails/confirmed_registration_text.blade.php
deleted file mode 100644
index 80cb85a..0000000
--- a/flexiapi/resources/views/mails/confirmed_registration_text.blade.php
+++ /dev/null
@@ -1,26 +0,0 @@
-Registration confirmed {{ space()->name }}
-
-Hello,
-
-@if (space()->confirmed_registration_text)
-{{ strip_tags(parsedown(space()->confirmed_registration_text)) }}
-@else
-Your SIP account has been successfully created.
-You can now configure this account on any SIP-compatible application using the following parameters:
-@endif
-
- SIP address: sip:{{ $account->identifier }}
- Username: {{ $account->username }}
- Domain: {{ $account->domain }}
-
-@if (!empty(space()?->account_proxy_registrar_address))
- Proxy/registrar address: sip:{{ space()?->account_proxy_registrar_address }}
-@endif
-@if (!empty(config('app.transport_protocol_text')))
- Transport: {{ config('app.transport_protocol_text') }}
-@endif
-
-Regards,
-{{ config('mail.signature') }}
-
-strip_tags
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/layout.blade.php b/flexiapi/resources/views/mails/layout.blade.php
new file mode 100644
index 0000000..5782c72
--- /dev/null
+++ b/flexiapi/resources/views/mails/layout.blade.php
@@ -0,0 +1,14 @@
+
+@yield('content')
+
+Regards,
+
+{{ config('mail.signature') }}
+
+
+You don’t have the app yet? [Download Linphone](https://www.linphone.org/en/docs/install-linphone/)
+
+Need help? [Visit our user guide](https://linphone.org/en/docs)
+
+
+
diff --git a/flexiapi/resources/views/mails/newsletter_registration.blade.php b/flexiapi/resources/views/mails/newsletter_registration.blade.php
index 78ebee7..a587105 100644
--- a/flexiapi/resources/views/mails/newsletter_registration.blade.php
+++ b/flexiapi/resources/views/mails/newsletter_registration.blade.php
@@ -1,11 +1,7 @@
-
-
- Mailing list email registration
-
-
- Hello,
-
- The following email address wants to register to the mailing list: {{ $account->email }}.
-
-
-
\ No newline at end of file
+@extends('mails.layout')
+
+@section('content')
+Hello,
+
+The following email address wants to register to the mailing list: {{ $account->email }}.
+@endsection
diff --git a/flexiapi/resources/views/mails/newsletter_registration_text.blade.php b/flexiapi/resources/views/mails/newsletter_registration_text.blade.php
deleted file mode 100644
index 2962630..0000000
--- a/flexiapi/resources/views/mails/newsletter_registration_text.blade.php
+++ /dev/null
@@ -1,3 +0,0 @@
-Hello,
-
-The following email address wants to register to the mailing list: {{ $account->email }}.
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/parts/provisioning.blade.php b/flexiapi/resources/views/mails/parts/provisioning.blade.php
new file mode 100644
index 0000000..52fdbd4
--- /dev/null
+++ b/flexiapi/resources/views/mails/parts/provisioning.blade.php
@@ -0,0 +1,9 @@
+To connect your account to the application, click on the following button:
+
+
+ Connect my account
+
+
+You can also configure your device by scanning the QR code with the mobile app, or by pasting the link below into the desktop application.
+
+ }})
diff --git a/flexiapi/resources/views/mails/provisioning.blade.php b/flexiapi/resources/views/mails/provisioning.blade.php
index a5404e5..fab5541 100644
--- a/flexiapi/resources/views/mails/provisioning.blade.php
+++ b/flexiapi/resources/views/mails/provisioning.blade.php
@@ -1,20 +1,9 @@
-
-
- Authenticate on {{ space()->name }}
-
-
- Hello,
-
- You are trying to authenticate to {{ space()->name }} using your device.
- You can configure your new device by directly flashing the QRCode or using the provisioning link:
+@extends('mails.layout')
- 
+@section('content')
+# Welcome to {{ space()->name }}
- Provisioning link: {{ $provisioning_link }}
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
\ No newline at end of file
+Hello {{ $account->identifier }},
+
+@include('mails.parts.provisioning')
+@endsection
diff --git a/flexiapi/resources/views/mails/provisioning_custom.blade.php.example b/flexiapi/resources/views/mails/provisioning_custom.blade.php.example
index 0990861..fab5541 100644
--- a/flexiapi/resources/views/mails/provisioning_custom.blade.php.example
+++ b/flexiapi/resources/views/mails/provisioning_custom.blade.php.example
@@ -1,19 +1,9 @@
-
-
- Authenticate on {{ space()->name }}
-
-
- Hello,
-
- You are trying to authenticate to {{ space()->name }} using your device.
- You can configure your new device by directly flashing the QRCode or using the provisioning link:
+@extends('mails.layout')
- 
- Provisioning link: {{ $provisioning_link }}
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
\ No newline at end of file
+@section('content')
+# Welcome to {{ space()->name }}
+
+Hello {{ $account->identifier }},
+
+@include('mails.parts.provisioning')
+@endsection
diff --git a/flexiapi/resources/views/mails/provisioning_text.blade.php b/flexiapi/resources/views/mails/provisioning_text.blade.php
deleted file mode 100644
index a0e2968..0000000
--- a/flexiapi/resources/views/mails/provisioning_text.blade.php
+++ /dev/null
@@ -1,10 +0,0 @@
-Hello,
-
-You are trying to authenticate to {{ space()->name }} using your device.
-
-You can configure your new device by using the provisioning link.
-
-Provisioning link: {{ $provisioning_link }}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/provisioning_text_custom.blade.php.example b/flexiapi/resources/views/mails/provisioning_text_custom.blade.php.example
deleted file mode 100644
index a0e2968..0000000
--- a/flexiapi/resources/views/mails/provisioning_text_custom.blade.php.example
+++ /dev/null
@@ -1,10 +0,0 @@
-Hello,
-
-You are trying to authenticate to {{ space()->name }} using your device.
-
-You can configure your new device by using the provisioning link.
-
-Provisioning link: {{ $provisioning_link }}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/recover_by_code.blade.php b/flexiapi/resources/views/mails/recover_by_code.blade.php
new file mode 100644
index 0000000..eedd5f7
--- /dev/null
+++ b/flexiapi/resources/views/mails/recover_by_code.blade.php
@@ -0,0 +1,20 @@
+@extends('mails.layout')
+
+@section('content')
+# Authenticate on {{ $account->space->name }}
+
+Hello {{ $account->identifier }},
+
+You are trying to authenticate to {{ $account->space->name }} using your email account.
+
+Please enter the code bellow to finish the authentication process.
+
+## {{ $account->recovery_code }
+
+@if (config('app.recovery_code_expiration_minutes') > 0)
+The code is only available {{ config('app.recovery_code_expiration_minutes') }} minutes.
+@endif
+
+@include('mails.parts.provisioning')
+
+@endsection
diff --git a/flexiapi/resources/views/mails/recover_by_code_custom.blade.php.example b/flexiapi/resources/views/mails/recover_by_code_custom.blade.php.example
new file mode 100644
index 0000000..eedd5f7
--- /dev/null
+++ b/flexiapi/resources/views/mails/recover_by_code_custom.blade.php.example
@@ -0,0 +1,20 @@
+@extends('mails.layout')
+
+@section('content')
+# Authenticate on {{ $account->space->name }}
+
+Hello {{ $account->identifier }},
+
+You are trying to authenticate to {{ $account->space->name }} using your email account.
+
+Please enter the code bellow to finish the authentication process.
+
+## {{ $account->recovery_code }
+
+@if (config('app.recovery_code_expiration_minutes') > 0)
+The code is only available {{ config('app.recovery_code_expiration_minutes') }} minutes.
+@endif
+
+@include('mails.parts.provisioning')
+
+@endsection
diff --git a/flexiapi/resources/views/mails/register_validate.blade.php b/flexiapi/resources/views/mails/register_validate.blade.php
deleted file mode 100644
index 260d584..0000000
--- a/flexiapi/resources/views/mails/register_validate.blade.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- Account registered on {{ space()->name }}
-
-
- Hello,
-
- You just created an account on {{ space()->name }} using your email account.
- Please enter the following code on the confirmation page:
-
-
-
{{ $code }}
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
diff --git a/flexiapi/resources/views/mails/register_validate_text.blade.php b/flexiapi/resources/views/mails/register_validate_text.blade.php
deleted file mode 100644
index 01fc500..0000000
--- a/flexiapi/resources/views/mails/register_validate_text.blade.php
+++ /dev/null
@@ -1,10 +0,0 @@
-Hello,
-
-You just created an account on {{ space()->name }} using your email account.
-
-Please enter the following code on the confirmation page:
-
-{{ $code }}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/mails/register_validation.blade.php b/flexiapi/resources/views/mails/register_validation.blade.php
new file mode 100644
index 0000000..d9e2be8
--- /dev/null
+++ b/flexiapi/resources/views/mails/register_validation.blade.php
@@ -0,0 +1,13 @@
+@extends('mails.layout')
+
+@section('content')
+# Account registration on {{ $account->space->name }}
+
+Hello {{ $account->identifier }},
+
+You just created an account on {{ $account->space->name }} using your email account.
+
+Please enter the following code on the confirmation page:
+
+## {{ $account->emailChangeCode()->first()->code }}
+@endsection
diff --git a/flexiapi/resources/views/mails/reset_password.blade.php b/flexiapi/resources/views/mails/reset_password.blade.php
index 73e12ca..fa41cd9 100644
--- a/flexiapi/resources/views/mails/reset_password.blade.php
+++ b/flexiapi/resources/views/mails/reset_password.blade.php
@@ -1,21 +1,15 @@
-
-
- Reset your password on {{ space()->name }}
-
-
- Hello,
-
- You are invited to reset your {{ $token->account->identifier }} account password on {{ space()->name }} via your email account.
-
- The following link will be valid for {{ config('app.reset_password_email_token_expiration_minutes')/60 }} hours.
-
-
- {{ route('account.reset_password_email.change', $token->token) }}
-
-
-
- Regards,
- {{ config('mail.signature') }}
-
-
-
+@extends('mails.layout')
+
+@section('content')
+# Reset your password on {{ $account->space->name }}
+
+Hello {{ $account->identifier }},
+
+You are invited to reset your {{ $account->identifier }} account password on {{ $account->space->name }} via your email account.
+
+The following link will be valid for {{ config('app.reset_password_email_token_expiration_minutes')/60 }} hours.
+
+
+ Reset by email
+
+@endsection
diff --git a/flexiapi/resources/views/mails/reset_password_text.blade.php b/flexiapi/resources/views/mails/reset_password_text.blade.php
deleted file mode 100644
index 79471f3..0000000
--- a/flexiapi/resources/views/mails/reset_password_text.blade.php
+++ /dev/null
@@ -1,10 +0,0 @@
-Hello,
-
-You are invited to reset your {{ $token->account->identifier }} account password on {{ space()->name }} via your email account.
-
-The following link will be valid for {{ config('app.reset_password_email_token_expiration_minutes')/60 }} hours.
-
-{{ route('account.reset_password_email.change', $token->token) }}
-
-Regards,
-{{ config('mail.signature') }}
\ No newline at end of file
diff --git a/flexiapi/resources/views/vendor/mail/html/button.blade.php b/flexiapi/resources/views/vendor/mail/html/button.blade.php
index e74fe55..4a9bf7d 100644
--- a/flexiapi/resources/views/vendor/mail/html/button.blade.php
+++ b/flexiapi/resources/views/vendor/mail/html/button.blade.php
@@ -1,13 +1,18 @@
-
+@props([
+ 'url',
+ 'color' => 'primary',
+ 'align' => 'center',
+])
+
-|
+ |
-|
+ |
diff --git a/flexiapi/resources/views/vendor/mail/html/header.blade.php b/flexiapi/resources/views/vendor/mail/html/header.blade.php
index fa1875c..56197f8 100644
--- a/flexiapi/resources/views/vendor/mail/html/header.blade.php
+++ b/flexiapi/resources/views/vendor/mail/html/header.blade.php
@@ -1,3 +1,4 @@
+@props(['url'])
|
|