Home > Software design >  Laravel reset password controller and function
Laravel reset password controller and function

Time:10-30

I am new to laravel and working on one laravel project. I am getting issue in finding larvel reset password controller and function.

Here is the html form code where the route is mentioned

 <form method="POST" action="{{ route('password.update') }}">

Here is the route path

  Route::get('/password/reset/{token}/{email}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');

I try to check the ResetPassword Controller but there is no showResetForm in this file. Can anybody tell me where I can check this function?

Here is the code of ResetPassword Controller

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;


class ResetPasswordController extends Controller
{
    

    use ResetsPasswords;

     
    protected $redirectTo = RouteServiceProvider::HOME;

    
    public function __construct()
    {
        $this->middleware('guest');
    }
    
}

Any help is appreciated Thanks and Regards

CodePudding user response:

you can check showResetForm function in Illuminate\Foundation\Auth\ResetsPasswords

https://github.com/guiwoda/laravel-framework/blob/master/src/Illuminate/Foundation/Auth/ResetsPasswords.php

CodePudding user response:

ResetPasswordController used ResetsPasswords trait.

In this trait you can find showResetForm() method.

You can overwrite this method in your ResetPasswordController controller.

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;


class ResetPasswordController extends Controller
{
    
    use ResetsPasswords;
     
    protected $redirectTo = RouteServiceProvider::HOME;

    
    public function __construct()
    {
        $this->middleware('guest');
    }

   /**
     * Display the password reset view for the given token.
     *
     * If no token is present, display the link request form.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function showResetForm(Request $request)
    {
        $token = $request->route()->parameter('token');

        return view('auth.passwords.reset')->with(
            ['token' => $token, 'email' => $request->email]
        );
    }
    
}
  • Related