From de1cca4feba3145a4511542ead397febbd75fbcc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 24 Aug 2020 23:36:12 -0600 Subject: [PATCH 1/2] Add password change email notification --- app/Http/Controllers/Settings/HomeSettings.php | 3 +++ app/Mail/PasswordChange.php | 8 +++++--- .../views/emails/notification/password_change.blade.php | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Settings/HomeSettings.php b/app/Http/Controllers/Settings/HomeSettings.php index aaf063c3..5279aa5e 100644 --- a/app/Http/Controllers/Settings/HomeSettings.php +++ b/app/Http/Controllers/Settings/HomeSettings.php @@ -12,7 +12,9 @@ use App\Util\Lexer\PrettyNumber; use Auth; use Cache; use DB; +use Mail; use Purify; +use App\Mail\PasswordChange; use Illuminate\Http\Request; trait HomeSettings @@ -127,6 +129,7 @@ trait HomeSettings $log->user_agent = $request->userAgent(); $log->save(); + Mail::to($request->user())->send(new PasswordChange($user)); return redirect('/settings/home')->with('status', 'Password successfully updated!'); } else { return redirect()->back()->with('error', 'There was an error with your request! Please try again.'); diff --git a/app/Mail/PasswordChange.php b/app/Mail/PasswordChange.php index f90c10b5..8cade5d9 100644 --- a/app/Mail/PasswordChange.php +++ b/app/Mail/PasswordChange.php @@ -16,9 +16,9 @@ class PasswordChange extends Mailable * * @return void */ - public function __construct() + public function __construct($user) { - // + $this->user = $user; } /** @@ -28,6 +28,8 @@ class PasswordChange extends Mailable */ public function build() { - return $this->markdown('emails.notification.password_change'); + return $this->with([ + 'user' => $this->user + ])->markdown('emails.notification.password_change'); } } diff --git a/resources/views/emails/notification/password_change.blade.php b/resources/views/emails/notification/password_change.blade.php index 1ff616e4..1d2cb3c8 100644 --- a/resources/views/emails/notification/password_change.blade.php +++ b/resources/views/emails/notification/password_change.blade.php @@ -1,12 +1,13 @@ @component('mail::message') # Account Password Changed +Hello @{{$user->username}}, @component('mail::panel')

The password for your account has been changed.

@endcomponent -If you did not make this change and believe your Pixelfed account has been compromised, please change your password immediately or contact the instance admin if you're locked out of your account. +If you did not make this change and believe your Pixelfed account has been compromised, please reset your password immediately or contact the instance admin if you're locked out of your account.
From 25be4ac9cc7fe161de30c1191e87da811706202d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 24 Aug 2020 23:37:46 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 258ca26a..428d3613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Add MediaTagService ([524c6d45](https://github.com/pixelfed/pixelfed/commit/524c6d45)) - Add MediaBlocklist feature ([ba1f7e7e](https://github.com/pixelfed/pixelfed/commit/ba1f7e7e)) - New Discover Layout, add trending hashtags, places and posts ([c251d41b](https://github.com/pixelfed/pixelfed/commit/c251d41b)) +- Add password change email notification. ([de1cca4f](https://github.com/pixelfed/pixelfed/commit/de1cca4f)) ### Updated - Updated PostComponent, fix remote urls ([42716ccc](https://github.com/pixelfed/pixelfed/commit/42716ccc))