php - Change Redirect Path -


so building web application in laravel framework (version 5.3) , want change redirect path whenever user fails login, far i've tried piece of code in logincontroller.php

protected $loginpath = "/my-given-path"; 

but doesn't seem work, tried inspecting authenticatesusers trait , got file , redirectusers trait , there no such function revolving around $loginpath exists, $redirectto exists.


alright came authenticatesusers trait , inspected couple of functions see :-

public function login(request $request) {     $this->validatelogin($request);      // if class using throttleslogins trait, can automatically throttle     // login attempts application. we'll key username ,     // ip address of client making these requests application.     if ($lockedout = $this->hastoomanyloginattempts($request)) {         $this->firelockoutevent($request);          return $this->sendlockoutresponse($request);     }      $credentials = $this->credentials($request);      if ($this->guard()->attempt($credentials, $request->has('remember'))) {         return $this->sendloginresponse($request);     }      // if login attempt unsuccessful increment number of attempts     // login , redirect user login form. of course, when     // user surpasses maximum number of attempts locked out.     if (! $lockedout) {         $this->incrementloginattempts($request);     }      return $this->sendfailedloginresponse($request); } 

hence need inspect `sendfailedloginresponse()' function , here goes :-

 protected function sendfailedloginresponse(request $request) {     return redirect()->back()         ->withinput($request->only($this->username(), 'remember'))         ->witherrors([             $this->username() => lang::get('auth.failed'),         ]); } 

so tried changing redirect()->back()... redirect('/my-given-path')... still no luck.


i have been trying solve problem whole day , can't come solution , one's asked before aren't of laravel 5.3 version. hence, i'd glad if tell what's going on , being wrong?

alright, found solution, think doing wrong when changing redirect()->back()... redirect('/my-given-url')... in authenticatesusers.php file under function sendfailedloginresponse().


but $loginpath no longer working , no such function exists in redirectusers trait, when $redirectto exists. have manually hardcode desired path in function of authenticatesusers trait.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -