misc_pterodactyl-panel/app/Http/Controllers/Auth/ForgotPasswordController.php

43 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http\Controllers\Auth;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Password;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Events\Auth\FailedPasswordReset;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
/**
* Get the response for a failed password reset link.
*
2017-08-22 03:10:48 +00:00
* @param string $response
*/
protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse
{
// As noted in #358 we will return success even if it failed
// to avoid pointing out that an account does or does not
// exist on the system.
event(new FailedPasswordReset($request->ip(), $request->input('email')));
2018-11-26 00:25:18 +00:00
return $this->sendResetLinkResponse($request, Password::RESET_LINK_SENT);
}
/**
* Get the response for a successful password reset link.
*
2019-09-06 04:32:57 +00:00
* @param string $response
*/
2019-06-12 06:19:43 +00:00
protected function sendResetLinkResponse(Request $request, $response): JsonResponse
{
return response()->json([
'status' => trans($response),
]);
}
}