Support the ongoing development of Laravel.io →
Authentication Forms
Last updated 1 year ago.
0

How do you create your user ? Remember to hash your password when inserting your new user :)

0

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.

0

Try


Auth::attempt(array("email" => "johndoe", "password" => "123"));

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

destrutorx destrutorx Joined 13 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.