1
votes

Attempt to login in Laravel with custom data: num Id, TipoId, password Auth, but I always returns false, not to be configured to accept different data to email and password:

$tipoId=Input::get('tipoId');
$numId=input::get('numId');
$password=Input::get('password');


$userdata =  array('tipoId' => Input::get('tipoId'), 'numId' => Input::get('numId'), 'password' => Input::get('password')  );
if (Auth::attempt($userdata)) {

        }else{
            return $userdata;
        }

Model

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class Login extends Eloquent  implements UserInterface,   RemindableInterface{

    use UserTrait, RemindableTrait;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'Logins';


}

Auth.php

return array(

'driver' => 'eloquent',

'model' => 'Login',

'table' => 'Logins',

'reminder' => array(

    'email' => 'emails.auth.reminder',

    'table' => 'password_reminders',

    'expire' => 60,

),

Does not leave me any error but every time I try to login, I always returns false, not this doing wrong?

1
Is the password in your database hashed with Hash::make()? - lukasgeiter
yes 'password' => Hash::make('12345') - Josè Omar Cabarcas Gutierrez
And is the password database field at least 60 characters long? (otherwise the hash get's truncated) - lukasgeiter
yes.. $2y$10$FQobU84gHR7ee5VfwUOHZuTFNd6UdLs/Izr9N - Josè Omar Cabarcas Gutierrez
And there we have the problem. This hash is only 44 characters long, that almost certainly means it got truncated. Your database field for the password has to be 60 characters long. Change that and update the hash. - lukasgeiter

1 Answers

0
votes

$2y$10$FQobU84gHR7ee5VfwUOHZuTFNd6UdLs/Izr9N

And there we have the problem. This hash is only 44 characters long, that almost certainly means it got truncated. Your database field for the password has to be 60 characters long. Change that and update the hash.