mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-30 20:23:48 +01:00
70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
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');
|
|
}
|
|
|
|
/**
|
|
* Validate the email for the given request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return void
|
|
*/
|
|
protected function validateEmail(Request $request)
|
|
{
|
|
$request->validate(['email' => 'required|exists:users,email']);
|
|
}
|
|
|
|
/**
|
|
* 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)];
|
|
// return response()->json(['status' => $response], 200);
|
|
}
|
|
|
|
/**
|
|
* 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)
|
|
{
|
|
return response()->json(['email' => trans($response)], 400);
|
|
}
|
|
}
|