2019-05-20 07:37:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
|
2020-01-14 17:06:59 +01:00
|
|
|
use Illuminate\Http\Request;
|
2020-01-14 23:45:32 +01:00
|
|
|
use App\Http\Controllers\Controller;
|
2019-05-20 07:37:41 +02:00
|
|
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
|
|
|
|
|
|
|
class ForgotPasswordController extends Controller
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Password Reset Controller
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| This controller is responsible for handling password reset emails and
|
|
|
|
| includes a trait which assists in sending these notifications from
|
|
|
|
| your application to your users. Feel free to explore this trait.
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
use SendsPasswordResetEmails;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('guest');
|
|
|
|
}
|
2020-01-14 17:06:59 +01:00
|
|
|
|
|
|
|
/**
|
2020-01-14 23:45:32 +01:00
|
|
|
* Validate the email for the given request.
|
2020-01-14 17:06:59 +01:00
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
2020-01-14 23:45:32 +01:00
|
|
|
* @return void
|
2020-01-14 17:06:59 +01:00
|
|
|
*/
|
2020-01-14 23:45:32 +01:00
|
|
|
protected function validateEmail(Request $request)
|
2020-01-14 17:06:59 +01:00
|
|
|
{
|
2020-01-14 23:45:32 +01:00
|
|
|
$request->validate(['email' => 'required|exists:users,email']);
|
|
|
|
}
|
2020-01-14 17:06:59 +01:00
|
|
|
|
2020-01-14 23:45:32 +01:00
|
|
|
/**
|
|
|
|
* Get the response for a successful password reset link.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param string $response
|
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
|
*/
|
|
|
|
protected function sendResetLinkResponse(Request $request, $response)
|
|
|
|
{
|
|
|
|
return ['status' => trans($response)];
|
|
|
|
}
|
2020-01-14 17:06:59 +01:00
|
|
|
|
2020-01-14 23:45:32 +01:00
|
|
|
/**
|
|
|
|
* Get the response for a failed password reset link.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param string $response
|
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
|
*/
|
|
|
|
protected function sendResetLinkFailedResponse(Request $request, $response)
|
|
|
|
{
|
2020-01-15 11:48:22 +01:00
|
|
|
return response()->json(['requestFailed' => trans($response)], 400);
|
2020-01-14 17:06:59 +01:00
|
|
|
}
|
2019-05-20 07:37:41 +02:00
|
|
|
}
|