How do you create your user ? Remember to hash your password when inserting your new user :)
Hi. I had already created the user using this code...
routes.php
Route::get('/registrar', function() {
$user = new Usuario;
$user->usuario = 'jonhdoe'; // User
$user->senha = Hash::make('123'); // Pass
$user->nome = 'John Benjamin Doe'; // Complete Name
$user->apelido = 'Johnny'; // Nickname
$user->save();
return 'Created';
});
But if I use this data (User = johndoe and Pass = 123), the login fail. I don't understand why.
Try
Auth::attempt(array("email" => "johndoe", "password" => "123"));
Thanks for the help. I found a solution.
I change this...
$dadosUsuario = array(
'usuario' => Input::get('usuario'), // User
'senha' => Input::get('senha') // Pass
);
for this...
$dadosUsuario = array(
'usuario' => Input::get('usuario'), // User
'password' => Input::get('senha') // Pass
);
and its works. I think this happenned because I translated the fields for my language and the laravel do not recognized the password.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community