mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-04-24 05:58:24 -05:00
#373 Refactor and improve e-mail handling
This commit is contained in:
@@ -54,7 +54,7 @@ class ShareController extends BaseController {
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($user->get('email'));
|
||||
$mailobj->setSubject(__('app.mail_share_photo_title'));
|
||||
$mailobj->setView('mail/share_photo', [], ['url_photo' => $result->data->url, 'url_asset' => $result->data->asset, 'url_removal' => share_api_host() . '/api/photo/remove?ident=' . $result->data->ident . '&ret=home']);
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/share_photo']], ['url_photo' => $result->data->url, 'url_asset' => $result->data->asset, 'url_removal' => share_api_host() . '/api/photo/remove?ident=' . $result->data->ident . '&ret=home']);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class CalendarInformerModel extends \Asatru\Database\Model {
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($user->get('email'));
|
||||
$mailobj->setSubject(__('app.mail_info_calendar_reminder'));
|
||||
$mailobj->setView('mail/calendar_reminder', [], ['item' => $item, 'user' => $user]);
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/calendar_reminder']], ['item' => $item, 'user' => $user]);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class TaskInformerModel extends \Asatru\Database\Model {
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($user->get('email'));
|
||||
$mailobj->setSubject(__('app.mail_info_task_' . $what));
|
||||
$mailobj->setView('mail/task_' . $what, [], ['task' => $task, 'user' => $user]);
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/task_' . $what]], ['task' => $task, 'user' => $user]);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class UserModel extends \Asatru\Database\Model {
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($email);
|
||||
$mailobj->setSubject(__('app.reset_password'));
|
||||
$mailobj->setView('mail/mailreset', [], ['workspace' => app('workspace'), 'token' => $reset_token]);
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/mailreset']], ['workspace' => app('workspace'), 'token' => $reset_token]);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
} catch (\Exception $e) {
|
||||
@@ -532,12 +532,12 @@ class UserModel extends \Asatru\Database\Model {
|
||||
static::raw('INSERT INTO `@THIS` (name, email, password) VALUES(?, ?, ?)', [
|
||||
$name, $email, password_hash($password, PASSWORD_BCRYPT)
|
||||
]);
|
||||
|
||||
|
||||
if ($sendmail) {
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($email);
|
||||
$mailobj->setSubject(__('app.account_created'));
|
||||
$mailobj->setView('mail/mailacccreated', [], ['workspace' => app('workspace'), 'password' => $password]);
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/mailacccreated']], ['workspace' => app('workspace'), 'password' => $password]);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
|
||||
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.mail_info_calendar_reminder') }}</h1>
|
||||
|
||||
<title>{{ __('app.mail_info_calendar_reminder') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.mail_info_calendar_reminder') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.mail_info_calendar_reminder_hint', ['name' => $item->get('name'), 'date_from' => date('Y-m-d', strtotime($item->get('date_from'))), 'date_till' => date('Y-m-d', strtotime($item->get('date_till'))), 'url' => workspace_url('/calendar')]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.mail_info_calendar_reminder_hint', ['name' => $item->get('name'), 'date_from' => date('Y-m-d', strtotime($item->get('date_from'))), 'date_till' => date('Y-m-d', strtotime($item->get('date_till'))), 'url' => workspace_url('/calendar')]) !!}
|
||||
</p>
|
||||
@@ -0,0 +1,118 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
|
||||
<meta name="viewport" content="with=device-width, initial-scale=1.0"/>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
background-color: rgb(31, 31, 31);
|
||||
color: rgb(150, 150, 150);
|
||||
margin: 0 auto;
|
||||
overflow-x: hidden;
|
||||
font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
||||
}
|
||||
|
||||
.headline {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
color: rgb(230, 230, 230);
|
||||
background-color: rgb(55, 55, 55);
|
||||
}
|
||||
|
||||
.headline img {
|
||||
position: relative;
|
||||
top: 10px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.headline a {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
font-size: 2.0em;
|
||||
text-decoration: none;
|
||||
color: rgb(111, 205, 132);
|
||||
font-family: Gabriola;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.headline a:hover {
|
||||
text-decoration: none;
|
||||
color: rgb(111, 205, 132);
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
color: rgb(200, 200, 200);
|
||||
background-color: rgb(31, 31, 31);
|
||||
}
|
||||
|
||||
.content p {
|
||||
width: 93%;
|
||||
}
|
||||
|
||||
.content a {
|
||||
color: rgb(105, 159, 202);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.content a:hover {
|
||||
color: rgb(105, 159, 202);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
color: rgb(150, 150, 150);
|
||||
background-color: rgb(55, 55, 55);
|
||||
font-size: 0.76em;
|
||||
}
|
||||
|
||||
.footer p {
|
||||
width: 93%;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: rgb(150, 135, 73);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
color: rgb(150, 135, 73);
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="headline">
|
||||
<span><img src="{{ asset('logo.png') }}"/> <a href="{{ url('/') }}">{{ app('workspace') }}</a></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
{%mail_content%}
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>
|
||||
<small><a href="{{ url('/') }}">{{ app('workspace') }}</a> ● Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small><a href="{{ env('APP_GITHUB_URL') }}">{{ env('APP_NAME') }}</a> is open-sourced software licensed under the MIT license.</small>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.account_created') }}</h1>
|
||||
|
||||
<title>{{ __('app.account_created') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.account_created') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.account_created_hint', ['workspace' => $workspace, 'url' => workspace_url('/auth'), 'password' => $password]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.account_created_hint', ['workspace' => $workspace, 'url' => workspace_url('/auth'), 'password' => $password]) !!}
|
||||
</p>
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.reset_password') }}</h1>
|
||||
|
||||
<title>{{ __('app.reset_password') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.reset_password') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.reset_password_hint', ['workspace' => $workspace, 'url' => workspace_url('/password/reset?token=' . $token)]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.reset_password_hint', ['workspace' => $workspace, 'url' => workspace_url('/password/reset?token=' . $token)]) !!}
|
||||
</p>
|
||||
@@ -1,30 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.mail_share_photo') }}</h1>
|
||||
|
||||
<title>{{ __('app.mail_share_photo') }}</title>
|
||||
<p>
|
||||
{!! __('app.mail_share_photo_hint', ['url_photo' => $url_photo, 'url_removal' => $url_removal]) !!}
|
||||
</p>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.mail_share_photo') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.mail_share_photo_hint', ['url_photo' => $url_photo, 'url_removal' => $url_removal]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img src="{{ $url_asset }}" alt="shared photo"/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
<img src="{{ $url_asset }}" alt="shared photo"/>
|
||||
</p>
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.mail_info_task_overdue') }}</h1>
|
||||
|
||||
<title>{{ __('app.mail_info_task_overdue') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.mail_info_task_overdue') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.mail_info_task_overdue_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.mail_info_task_overdue_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.mail_info_task_recurring') }}</h1>
|
||||
|
||||
<title>{{ __('app.mail_info_task_recurring') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.mail_info_task_recurring') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.mail_info_task_recurring_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'time' => $task->get('recurring_time'), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.mail_info_task_recurring_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'time' => $task->get('recurring_time'), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
@@ -1,26 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<h1>{{ __('app.mail_info_task_tomorrow') }}</h1>
|
||||
|
||||
<title>{{ __('app.mail_info_task_tomorrow') }}</title>
|
||||
|
||||
@if (ThemeModule::hasMailStyles())
|
||||
<style>
|
||||
{{ ThemeModule::getMailStyles() }}
|
||||
</style>
|
||||
@endif
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ __('app.mail_info_task_tomorrow') }}</h1>
|
||||
|
||||
<p>
|
||||
{!! __('app.mail_info_task_tomorrow_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<small>Powered by {{ env('APP_NAME') }}</small>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p>
|
||||
{!! __('app.mail_info_task_tomorrow_hint', ['name' => $task->get('title'), 'date' => date('Y-m-d', strtotime($task->get('due_date'))), 'url' => workspace_url('/tasks')]) !!}
|
||||
</p>
|
||||
Reference in New Issue
Block a user