#124, #125, #126: Started implementing e-mail queueing. Fixed the display of validation messages on the forgotten password form. Corrected the generation of the action URL when the APP_URL environment settings is not configured.
This commit is contained in:
parent
07fa9639b5
commit
bfbf740810
@ -121,6 +121,7 @@ class ConfigHelper
|
||||
'photo_comments_allowed_html' => 'p,div,span,a,b,i,u',
|
||||
'photo_comments_thread_depth' => 3,
|
||||
'public_statistics' => true,
|
||||
'queue_emails' => false,
|
||||
'rabbitmq_enabled' => false,
|
||||
'rabbitmq_server' => 'localhost',
|
||||
'rabbitmq_password' => encrypt('guest'),
|
||||
|
@ -243,6 +243,7 @@ class DefaultController extends Controller
|
||||
'hotlink_protection',
|
||||
'moderate_anonymous_users',
|
||||
'moderate_known_users',
|
||||
'queue_emails',
|
||||
'rabbitmq_enabled',
|
||||
'recaptcha_enabled_registration',
|
||||
'remove_copyright',
|
||||
|
69
app/Notifications/ResetPassword.php
Normal file
69
app/Notifications/ResetPassword.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class ResetPassword extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* The password reset token.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* Create a notification instance.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)
|
||||
->line('You are receiving this email because we received a password reset request for your account.')
|
||||
->action('Reset Password', route('password.reset', $this->token, true))
|
||||
->line('If you did not request a password reset, no further action is required.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
12
app/User.php
12
app/User.php
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Notifications\ResetPassword;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -106,6 +107,17 @@ class User extends Authenticatable
|
||||
return trim(!empty($this->profile_alias) ? $this->profile_alias : $this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function sendPasswordResetNotification($token)
|
||||
{
|
||||
$this->notify(new ResetPassword($token));
|
||||
}
|
||||
|
||||
public function unFollowUrl()
|
||||
{
|
||||
return route('unFollowUser', [
|
||||
|
@ -15,7 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_DRIVER', 'sync'),
|
||||
'default' => env('QUEUE_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -36,34 +36,10 @@ return [
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'table' => 'background_jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => 'your-public-key',
|
||||
'secret' => 'your-secret-key',
|
||||
'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
|
||||
'queue' => 'your-queue-name',
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
]
|
||||
],
|
||||
|
||||
/*
|
||||
|
36
database/migrations/2019_07_13_203923_create_jobs_table.php
Normal file
36
database/migrations/2019_07_13_203923_create_jobs_table.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('background_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('background_jobs');
|
||||
}
|
||||
}
|
@ -285,6 +285,9 @@ return [
|
||||
'image_processing_tab' => 'Image Processing',
|
||||
'permissions_cache' => 'Permissions Cache',
|
||||
'permissions_cache_intro' => 'Blue Twilight maintains the permissions each user has to albums in the database. If you feel these aren\'t correct based on what\'s configured, you can rebuild the cache by clicking the button below.',
|
||||
'queue_emails' => [
|
||||
'title' => 'Queue E-mails'
|
||||
],
|
||||
'rebuild_permissions_cache' => 'Rebuild Permissions Cache',
|
||||
'rebuild_permissions_cache_failed' => 'The permissions cache rebuild failed to complete. Please check the server logs.',
|
||||
'rebuild_permissions_cache_succeeded' => 'The permissions cache rebuild completed successfully.',
|
||||
|
@ -63,6 +63,8 @@ return [
|
||||
'settings_allow_photo_comments_anonymous' => 'Allow anonymous users to comment on photos',
|
||||
'settings_allow_photo_comments_anonymous_help' => 'With this option enabled, users can post comments without being logged in.',
|
||||
'settings_allow_photo_comments_help' => 'With this option enabled, users can comment on individual photos.',
|
||||
'settings_queue_emails' => 'Queue e-mails in the database',
|
||||
'settings_queue_emails_help' => 'You will need to configure a cron job to actually send the e-mails.',
|
||||
'settings_photo_comments_allowed_html' => 'HTML tags allowed in comments:',
|
||||
'settings_photo_comments_allowed_html_help' => 'Enter a comma-separated list of HTML tags (without angle brackets) that are allowed in comments. All other tags (and their content) will be removed when a comment is posted.',
|
||||
'settings_photo_comments_thread_depth' => 'Maximum depth for nested comments:',
|
||||
|
@ -246,7 +246,9 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<fieldset style="margin-top: 20px;">
|
||||
<hr class="mt-4"/>
|
||||
|
||||
<fieldset>
|
||||
<legend>SMTP Server</legend>
|
||||
<p style="margin-bottom: 15px;">Configure your SMTP server using the settings below. If your server does not require authentication, leave the Username and Password fields empty.</p>
|
||||
|
||||
@ -316,6 +318,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<hr/>
|
||||
|
||||
<fieldset class="mt-3">
|
||||
<legend>@lang('admin.settings.queue_emails.title')</legend>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="queue-emails" name="queue_emails" @if (old('queue_emails', UserConfig::get('queue_emails')))checked="checked"@endif>
|
||||
<label class="form-check-label" for="queue-emails">
|
||||
<strong>@lang('forms.settings_queue_emails')</strong><br/>
|
||||
@lang('forms.settings_queue_emails_help')
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{-- Security --}}
|
||||
|
@ -17,14 +17,14 @@
|
||||
<form role="form" method="POST" action="{{ url('/password/email') }}">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="form-group row{{ $errors->has('email') ? ' has-danger' : '' }}">
|
||||
<div class="form-group row">
|
||||
<label for="email" class="col-md-4 col-form-label text-md-right">@lang('forms.email_label')</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}">
|
||||
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}">
|
||||
|
||||
@if ($errors->has('email'))
|
||||
<div class="form-control-feedback">
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('email') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
|
Loading…
Reference in New Issue
Block a user