dimanche 6 octobre 2019

Reset password using phone number laravel

I'am getting this error The GET method is not supported for this route. Supported methods: POST when I try to redirect the user back if the token is invalid. How do I solve this?

ForgotPasswordController

  public function showPasswordResetForm(Request $request,$token)
  {
   $inputToken = $request->token;
   $tokenData = DB::table('password_resets')
    ->where('token', $token)->first();
    $token = $tokenData->token;

    if ($inputToken != $token) return redirect()->back()- 
      >withErrors(['token' => 'Token doesnt exist']); //redirect  
         back if the token does not exist.
      return view('auth.passwords.reset')->with('token', $token);
   }

Blade

 <div class="card-body">
   <form method="GET" action=" 
     ">
       @csrf
    <input id='token' type="text"class="formcontrol @error('token') 
      is-invalid @enderror" name="token" required 
        autocomplete="token"autofocus>
           @error('token')
           <span class="invalid-feedback" 
             role="alert">
           <strong></strong>
            </span>
             @enderror
    </div>
   </div>

Routes

Route::get('reset-password/{token}', 
       'Auth\ForgotPasswordController@showPasswordResetForm')- 
       >name('check.token');


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire