Validate the password reset token before showing the reset form
Example to Validate the password reset token before showing the reset form:
public function checkToken($token,$email)
{
$password_resets = DB::table('password_resets')->where('email', $email)->first();
if ($password_resets && Hash::check($token, $password_resets->token)) {
$createdAt = Carbon::parse($password_resets->created_at);
if (!Carbon::now()->greaterThan($createdAt->addMinutes(config('auth.passwords.users.expire')))) {
return \response()->json()->setStatusCode(200);
}
}
return \response()->json()->setStatusCode(419);
}