php - laravel5 ,\Auth::check(),return true,but attempt() return false -


after login,i want add logic before controller,so wrote in middleware . but,i found when

dd(\auth::check());  // returns true; 

but

$eid = \auth::user()->eid;  //can print value $password = \auth::user()->password; //can print value, dd(\auth::validate(['eid'=>$eid,'password'=>$password]));  //it returns false   

the whole code:

public function handle($request, closure $next) {     dd(\auth::check());     $eid = \auth::user()->eid;     $password = \auth::user()->password;     dd(\auth::validate(['eid'=>$eid,'password'=>$password]));     if ($this->auth->guest())     { // not login         if ($request->ajax())         {             return response('unauthorized.', 401);         }         else         {             return redirect()->guest('auth/login');         }     }      return $next($request); } 

auth::user()->password password hash , cannot used in validate() function. can use actual plaintext password in auth::validate()


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -