I have the following ForgottenPasswordController
<?php
namespace App\Http\Controllers\v1;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
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;
protected function sendResetLinkResponse(Request $request, $response)
{
return response(['message' => $response]);
}
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response(['message' => $response], 422);
}
}
and the following ResetPasswordController
<?php
namespace App\Http\Controllers\v1;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
protected function sendResetResponse(Request $request, $response)
{
return response(['message' => $response]);
}
protected function sendResetFailedResponse(Request $request, $response)
{
return response(['error' => $response], 422);
}
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
}
When I make an axios reqeust to the forgotPasswordController I get the email delivered as expected. When I then submit my new password, along with the email address and token back to ResetPasswordController I get the following response,
error: "passwords.token"
on further ispection at the point where a reset is requested no email or token is saved in the password_resets table, why would this be, I have changed nothing in the Auth scaffolding via laravel/ui --auth
other than make the response from 2 methods be json and not blade views.
php artisan migrate
after yourcomposer require laravel/ui
? – Vitalijreturn response(['message' => trans($response)]);
– Vitalij