mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 11:47:53 +02: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;
|
namespace App;
|
||||||
|
|
||||||
use App\Notifications\ResetPassword;
|
use Illuminate\Auth\Notifications\ResetPassword;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
@ -20,7 +20,7 @@ Route::group(['middleware' => 'guest:api'], function () {
|
|||||||
Route::post('register', 'Auth\RegisterController@register');
|
Route::post('register', 'Auth\RegisterController@register');
|
||||||
|
|
||||||
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
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 @@ class ForgotPasswordTest extends TestCase
|
|||||||
'remember_token' => \Illuminate\Support\Str::random(10),
|
'remember_token' => \Illuminate\Support\Str::random(10),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//$this->expectsNotification($this->user, ResetPassword::class);
|
|
||||||
|
|
||||||
$response = $this->json('POST', '/api/password/email', [
|
$response = $this->json('POST', '/api/password/email', [
|
||||||
'email' => $this->user->email
|
'email' => $this->user->email
|
||||||
]);
|
]);
|
||||||
@ -82,9 +80,9 @@ class ForgotPasswordTest extends TestCase
|
|||||||
$token = \Illuminate\Support\Facades\DB::table('password_resets')->first();
|
$token = \Illuminate\Support\Facades\DB::table('password_resets')->first();
|
||||||
$this->assertNotNull($token);
|
$this->assertNotNull($token);
|
||||||
|
|
||||||
// Notification::assertSentTo($this->user, ResetPassword::class, function ($notification, $channels) use ($token) {
|
Notification::assertSentTo($this->user, ResetPassword::class, function ($notification, $channels) use ($token) {
|
||||||
// return Hash::check($notification->token, $token->token) === true;
|
return Hash::check($notification->token, $token->token) === true;
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user