php - laravel 5.2 Auth:attemp always returns false -
i facing issue auth:attempt method returning me false value.
my db entries are:
- username: admin
- password: $2y$10$jxkny3wc2wqu0jmaqofdiogdnbv89uyvjpcnsu8xonmo3w9rjt53s
note: stored password manually after echoing output of hash::make('admin').
the code authentication is:
// create our user data authentication $userdata = array( 'username' => input::get('username'), 'password' => input::get('password'), 'agencyactive' => 1 ); if (auth::attempt($userdata)) { echo 'success!';exit; } else { echo "<br>login error";exit; }
it prints "login error".
for troubleshooting logged sql query, retrieves proper record,
select * `agencies` `username` = 'admin' , `agencyactive` = 1 limit 1
surprisingly, when verified comparison below, prints matches
if (\hash::check('admin', '$2y$10$jxkny3wc2wqu0jmaqofdiogdnbv89uyvjpcnsu8xonmo3w9rjt53s')) { // passwords match... echo "matches"; } else { echo "no match"; }
i have no clue what's going wrong here ???
do have model instead default user.
if can go config/auth.php , change:
'model' => 'myapp\models\agency',
for example
Comments
Post a Comment