2
I’m having trouble logging in Laravel.
See, it does not log the user, but also does not return error:
auth.php
return array(
'driver' => 'eloquent',
'model' => 'Cliente',
'table' => 'cliente',
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
My Model Php client.
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Cliente extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
protected $table = 'cliente';
protected $hidden = array('password', 'remember_token');
protected $fillable = [/*Meus campos*/];
public function getAuthIdentifier(){
return $this->getKey();
}
public function getAuthPassword(){
return $this->password;
}
}
My Controller Authcontroller.php
class AuthController extends BaseController{
public function __construct(){}
public function postLogin(){
$credentials = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
if(Auth::attempt($credentials,false)){
return Redirect::to('/reserva');
}
return Redirect::to('/')
->with('message','Erro ao se logar, verifique o e-mail ou senha digitado.');
}
public function getLogout(){
Auth::logout();
return Redirect::to('login');
}
}
My view:
{{ Form::open(['url' => 'auth/login','method' => 'post']) }}
@if(Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
{{ Form::text('email'); }}
{{ Form::password('password'); }}
{{ Form::submit('Acessar') }}
{{ Form::close() }}
In the database, the fields are respectively email and password in the client table.
– Ewerton Melo
Seeing it like this all right! he did not make mistakes ?
– user6026
None, if I give a dd(Auth::Attempt($credentials,false)) simply returns me false... ;(
– Ewerton Melo
you generated the password correctly?
– user6026