mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Add password change email notification
This commit is contained in:
parent
5e471d55cd
commit
de1cca4feb
3 changed files with 10 additions and 4 deletions
|
@ -12,7 +12,9 @@ use App\Util\Lexer\PrettyNumber;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Mail;
|
||||||
use Purify;
|
use Purify;
|
||||||
|
use App\Mail\PasswordChange;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
trait HomeSettings
|
trait HomeSettings
|
||||||
|
@ -127,6 +129,7 @@ trait HomeSettings
|
||||||
$log->user_agent = $request->userAgent();
|
$log->user_agent = $request->userAgent();
|
||||||
$log->save();
|
$log->save();
|
||||||
|
|
||||||
|
Mail::to($request->user())->send(new PasswordChange($user));
|
||||||
return redirect('/settings/home')->with('status', 'Password successfully updated!');
|
return redirect('/settings/home')->with('status', 'Password successfully updated!');
|
||||||
} else {
|
} else {
|
||||||
return redirect()->back()->with('error', 'There was an error with your request! Please try again.');
|
return redirect()->back()->with('error', 'There was an error with your request! Please try again.');
|
||||||
|
|
|
@ -16,9 +16,9 @@ class PasswordChange extends Mailable
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct($user)
|
||||||
{
|
{
|
||||||
//
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,8 @@ class PasswordChange extends Mailable
|
||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->markdown('emails.notification.password_change');
|
return $this->with([
|
||||||
|
'user' => $this->user
|
||||||
|
])->markdown('emails.notification.password_change');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
@component('mail::message')
|
@component('mail::message')
|
||||||
# Account Password Changed
|
# Account Password Changed
|
||||||
|
|
||||||
|
Hello @{{$user->username}},
|
||||||
|
|
||||||
@component('mail::panel')
|
@component('mail::panel')
|
||||||
<p>The password for your account has been changed.</p>
|
<p>The password for your account has been changed.</p>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
|
||||||
<small>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.</small>
|
<small>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.</small>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue