Password Reset work

This commit is contained in:
Deon George
2020-01-22 21:05:31 +11:00
parent b42f9990b5
commit 436c3d6787
10 changed files with 72 additions and 62 deletions

View File

@@ -20,16 +20,6 @@ class ForgotPasswordController extends Controller
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
public function showLinkRequestForm()
{
return view('adminlte::auth.passwords.email');

View File

@@ -2,10 +2,12 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
class ResetPasswordController extends Controller
{
/*
@@ -26,26 +28,8 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
protected function rules()
{
return [
'token' => 'required',
'email' => 'required|email|exists:users',
'password' => 'required|confirmed|min:6',
];
}
public function showResetForm(Request $request, $token = null)
{
return view('adminlte::auth.passwords.reset')->with(

View File

@@ -11,23 +11,36 @@ class ResetPasswordNotification extends Notification
{
use Queueable;
public $token;
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a new notification instance.
* The callback that should be used to build the mail message.
*
* @var \Closure|null
*/
public static $toMailCallback;
/**
* Create a notification instance.
*
* @param string $token
* @return void
*/
public function __construct($token)
{
$this->token = $token;
$this->token = $token;
}
/**
* Get the notification's delivery channels.
* Get the notification's channels.
*
* @param mixed $notifiable
* @return array
* @return array|string
*/
public function via($notifiable)
{
@@ -35,18 +48,33 @@ class ResetPasswordNotification extends Notification
}
/**
* Get the mail representation of the notification.
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$logo = config('SITE_SETUP')->site_logo;
$site_name = config('SITE_SETUP')->site_name;
$reset_link = route('password.reset', $this->token, true);
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
return (new MailMessage)
->markdown('email.user.passwordreset',compact('logo','site_name','reset_link'));
return (new MailMessage)
->markdown('email.user.passwordreset',[
'site'=>config('SITE_SETUP'),
'user'=>$notifiable,
'reset_link'=>route('password.reset',$this->token,true),
]);
}
}
/**
* Set a callback that should be used when building the notification mail message.
*
* @param \Closure $callback
* @return void
*/
public static function toMailUsing($callback)
{
static::$toMailCallback = $callback;
}
}