send login information to the bank for comparison

Asked

Viewed 57 times

2

I am developing a system with login and password, using Windows. The registration part was even easy:

public function salvar(){
    $usu_email = Request()->input('usu_email');
    $usu_senha = Request()->input('usu_senha');
    $usu_tipo = Request()->input('usu_tipo');

    DB::insert('INSERT INTO usr_usuario (usu_email, usu_senha, usu_tipo) VALUES (?, md5(?), ?)', array($usu_email, $usu_senha, $usu_tipo));

    return redirect() ->action('ProjetoController@inicio');
}

But in the part of sending the information to the bank and comparing them I am a little confused. In the bank I have the following script that will make the comparison:

 select usu_codigo,usu_tipo 
 from usr_usuario
 where usu_email=:usu_email
 and usu_senha=md5(:usu_senha)

But I don’t know how I do in my Projectocontroller.php to send the information. I believe it’s something similar to sending to the bank on the record.

  • Please do not use images to show your code. Put it as text so we can help.

  • because you do not use the proper methods of the Laravel? https://laravel.com/docs/5.2/authentication

1 answer

3

You can use the authentication itself Laravel already offers.

At the beginning of your controller give a "use Auth;" to use the class Auth inside your controller.

public function authenticate()
{
    if ( Auth::attempt(['email' => $email, 'password' => bcrypt( $password ) ])) {
        // Autenticação autorizada...
    }
}
  • so I’m not using the ready form that comes in Laravel and I’m also not using the table names that comes in Laravel, what I need to change and where?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.