mardi 30 mai 2017

Laravel 5: Redirect Not Working on Password Reset

I am trying to override Laravel's default function for resetting passwords. Before I go ahead with resetting the password, I want to dynamically set $redirectTo based on certain user information, so that the user is properly redirected to a different page based on said info. However, when I go try to go through with it I end up at a completely white page with the path ".../password/reset". The user's password is being properly reset, but the redirect isn't working as intended.

My code is referenced below. What am I doing wrong?

ResetPasswordController.php

class ResetPasswordController extends Controller
    {

        use ResetsPasswords;

        protected $redirectTo;

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

        public function resetPasswordByUser(Request $request, Users $users)
        {
                $user = $users->findUserByEmail($request->input('email'));

                if ($user->case == 1) {
                    $this->redirectTo = '/case1';
                } elseif ($user->case == 2) {
                    $this->redirectTo = '/case2';
                } elseif ($user->case == 3) {
                    $this->redirectTo = '/case3';
                }

                $this->reset($request);

            }
    }

web.php

Auth::routes();

.......

Route::post('/password/reset', 'Auth\ResetPasswordController@resetPasswordByUser');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qD2lCi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire