mongodb - Middleware does not redirect to page on success of auth attempt.Using laravel 5.2 and Mongo DB -
this in routes
route::post('companylogin','auth\authcontroller@companylogin');   route::group(['middleware' => 'auth'], function () {  route::get('dashboard',['uses' => 'pagecontroller@dashboard' ,  'as' => 'dashboard']);  }); this controller:
<?php  namespace app\http\controllers\auth;  use app\user;  use validator;  use app\http\controllers\controller;  use illuminate\foundation\auth\throttleslogins;  use illuminate\foundation\auth\authenticatesandregistersusers;  use illuminate\support\facades\input;  use illuminate\support\facades\redirect;  use illuminate\support\facades\request;  use illuminate\support\facades\auth;  use view;  class authcontroller extends controller  {   public function companylogin()      {        $userdata = array(              'email' => input::get('email'),              'password'  =>input::get('password'));         $isauth = auth::attempt($userdata);          if($isauth)         {             return redirect()->intended('dashboard');           } else {                     return view('login');          }      } } 
may credentials wrong.
->i mean did bcrypted password , saved in database. ->if not bcrypted password,then must bcrypt password , save in database. ->auth::attemptbcrypt password , checks  example:
$userdata = array(              'email' => 'yahoo@gmail.com',              'password'  =>'yahoo';         $isauth = auth::attempt($userdata); auth::attempt bcrypts yahoo password , checks in database , returns false redirecting login
Comments
Post a Comment