mercredi 27 décembre 2017

Use Auth to authenticate user data in mysql always fails

I have a table in mysql database which has user_name,password as columns, so I want to check the users logins with Auth class.

but the user fails to check his data even it is right.

Should I make migration to database to achieve my goal.

Controller function

 public function store(Request $request)
 {

 $userdata = array('user_name' => Request::get('user_name'),'password'  => Request::get('password')
  );

 if (!Auth::attempt($userdata))
 {
 return 'fail';

  }

  } 

My form

 <form  method="POST" action=""> 
   
 <input type="text" name="user_name" >
  <input type="password" name="password"  >
  <div class="tp">
  <input type="submit" value="LOGIN NOW">
  </div>
  </form>    

Routes

 Route::post('users ',['uses'=>'UserController@store']);  



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

Aucun commentaire:

Enregistrer un commentaire