mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-22 22:30:05 +01:00
Restore native ResetPassword notification and test it
This commit is contained in:
parent
23a49fbb83
commit
8927a4c7c0
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Auth\Notifications\ResetPassword as Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class ResetPassword extends Notification
|
||||
{
|
||||
|
||||
/**
|
||||
* 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', url(config('app.url').'/password/reset/'.$this->token).'?email='.urlencode($notifiable->email))
|
||||
->line('If you did not request a password reset, no further action is required.');
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Notifications\ResetPassword;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
@ -20,7 +20,7 @@
|
||||
Route::post('register', 'Auth\RegisterController@register');
|
||||
|
||||
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@reset');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.reset');
|
||||
|
||||
});
|
||||
|
||||
|
@ -71,8 +71,6 @@ public function testSubmitEmailPasswordRequest()
|
||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||
]);
|
||||
|
||||
//$this->expectsNotification($this->user, ResetPassword::class);
|
||||
|
||||
$response = $this->json('POST', '/api/password/email', [
|
||||
'email' => $this->user->email
|
||||
]);
|
||||
@ -82,9 +80,9 @@ public function testSubmitEmailPasswordRequest()
|
||||
$token = \Illuminate\Support\Facades\DB::table('password_resets')->first();
|
||||
$this->assertNotNull($token);
|
||||
|
||||
// Notification::assertSentTo($this->user, ResetPassword::class, function ($notification, $channels) use ($token) {
|
||||
// return Hash::check($notification->token, $token->token) === true;
|
||||
// });
|
||||
Notification::assertSentTo($this->user, ResetPassword::class, function ($notification, $channels) use ($token) {
|
||||
return Hash::check($notification->token, $token->token) === true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user