mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Convert controller validation to Form Requests
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Requests\Auth\ShowLinkRequestFormForgotPasswordRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\SendPasswordForgottenEmail;
|
||||
use App\Models\User;
|
||||
@@ -37,7 +38,7 @@ class ForgotPasswordController extends Controller
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showLinkRequestForm(Request $request): void
|
||||
public function showLinkRequestForm(ShowLinkRequestFormForgotPasswordRequest $request): void
|
||||
{
|
||||
$sent = '';
|
||||
$email = $request->input('email') ?? '';
|
||||
@@ -46,9 +47,6 @@ class ForgotPasswordController extends Controller
|
||||
app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset');
|
||||
} else {
|
||||
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
|
||||
$this->validate($request, [
|
||||
'g-recaptcha-response' => 'required|captcha',
|
||||
]);
|
||||
}
|
||||
//
|
||||
// Check users exists and send an email
|
||||
|
||||
@@ -8,12 +8,11 @@ class ShowLinkRequestFormForgotPasswordRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
public function rules()
|
||||
{
|
||||
return ['g-recaptcha-response' => [
|
||||
'required',
|
||||
'captcha',
|
||||
], ];
|
||||
return ['g-recaptcha-response' => 'required|captcha'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user