diff --git a/app/Helpers/ConfigHelper.php b/app/Helpers/ConfigHelper.php index e5a7728..cab4eb1 100644 --- a/app/Helpers/ConfigHelper.php +++ b/app/Helpers/ConfigHelper.php @@ -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'), diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index f4b2546..33f2e01 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -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', diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php new file mode 100644 index 0000000..68f7ecf --- /dev/null +++ b/app/Notifications/ResetPassword.php @@ -0,0 +1,69 @@ +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 [ + // + ]; + } +} diff --git a/app/User.php b/app/User.php index 92a25f3..f83a422 100644 --- a/app/User.php +++ b/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', [ diff --git a/config/queue.php b/config/queue.php index 549322e..0f15a2d 100644 --- a/config/queue.php +++ b/config/queue.php @@ -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, - ], - + ] ], /* diff --git a/database/migrations/2019_07_13_203923_create_jobs_table.php b/database/migrations/2019_07_13_203923_create_jobs_table.php new file mode 100644 index 0000000..8533de5 --- /dev/null +++ b/database/migrations/2019_07_13_203923_create_jobs_table.php @@ -0,0 +1,36 @@ +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'); + } +} diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index ea58831..6940c04 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -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.', diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php index 5f64662..ceda533 100644 --- a/resources/lang/en/forms.php +++ b/resources/lang/en/forms.php @@ -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:', diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index db32136..4cab825 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -246,7 +246,9 @@ @endif -
+
+ +
SMTP Server

Configure your SMTP server using the settings below. If your server does not require authentication, leave the Username and Password fields empty.

@@ -316,6 +318,20 @@
+ +
+ +
+ @lang('admin.settings.queue_emails.title') + +
+ + +
+
{{-- Security --}} diff --git a/resources/views/themes/base/auth/passwords/email.blade.php b/resources/views/themes/base/auth/passwords/email.blade.php index 672dc4b..8b2a0a3 100644 --- a/resources/views/themes/base/auth/passwords/email.blade.php +++ b/resources/views/themes/base/auth/passwords/email.blade.php @@ -17,14 +17,14 @@
{{ csrf_field() }} -
+
- + @if ($errors->has('email')) -