2016-09-03 21:09:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Auth;
|
|
|
|
|
2017-03-30 21:44:20 +00:00
|
|
|
use Illuminate\Http\Request;
|
2018-04-07 21:17:51 +00:00
|
|
|
use Illuminate\Http\JsonResponse;
|
2017-03-30 21:44:20 +00:00
|
|
|
use Illuminate\Support\Facades\Password;
|
2016-09-03 21:09:00 +00:00
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
2017-03-30 21:44:20 +00:00
|
|
|
use Pterodactyl\Events\Auth\FailedPasswordReset;
|
2016-09-03 21:09:00 +00:00
|
|
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
|
|
|
|
|
|
|
class ForgotPasswordController extends Controller
|
|
|
|
{
|
|
|
|
use SendsPasswordResetEmails;
|
|
|
|
|
2017-03-30 21:44:20 +00:00
|
|
|
/**
|
|
|
|
* Get the response for a failed password reset link.
|
|
|
|
*
|
2017-08-22 03:10:48 +00:00
|
|
|
* @param string $response
|
2017-03-30 21:44:20 +00:00
|
|
|
*/
|
2018-04-07 21:17:51 +00:00
|
|
|
protected function sendResetLinkFailedResponse(Request $request, $response): JsonResponse
|
2017-03-30 21:44:20 +00:00
|
|
|
{
|
|
|
|
// 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.
|
2017-11-18 21:09:58 +00:00
|
|
|
event(new FailedPasswordReset($request->ip(), $request->input('email')));
|
2017-03-30 21:44:20 +00:00
|
|
|
|
2018-11-26 00:25:18 +00:00
|
|
|
return $this->sendResetLinkResponse($request, Password::RESET_LINK_SENT);
|
2017-03-30 21:44:20 +00:00
|
|
|
}
|
2018-04-07 17:35:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the response for a successful password reset link.
|
|
|
|
*
|
2019-09-06 04:32:57 +00:00
|
|
|
* @param string $response
|
2018-04-07 17:35:15 +00:00
|
|
|
*/
|
2019-06-12 06:19:43 +00:00
|
|
|
protected function sendResetLinkResponse(Request $request, $response): JsonResponse
|
2018-04-07 17:35:15 +00:00
|
|
|
{
|
|
|
|
return response()->json([
|
|
|
|
'status' => trans($response),
|
|
|
|
]);
|
|
|
|
}
|
2016-09-03 21:09:00 +00:00
|
|
|
}
|