2FAuth/app/Http/Controllers/Auth/ForgotPasswordController.php

61 lines
1.7 KiB
PHP
Raw Normal View History

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;
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
2020-03-05 16:41:55 +01:00
*
* @codeCoverageIgnore Can't find how to test this :/
2020-01-14 23:45:32 +01:00
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response()->json(['requestFailed' => trans($response)], 400);
2020-01-14 17:06:59 +01:00
}
2019-05-20 07:37:41 +02:00
}