I'm trying to do a basic authentication, and I have many problems, the main one is this
This error when I send the form and try to authenticate
blade
{{ Form::open(array('url' => 'usuario')) }}
<input type="text" class="text" id="email" name="email" placeholder="Correo" {{(Input::old('email')) ? 'value ="'. Input::old('email').'"' : '' }}>
<p>{{ $errors->first('email') }}</p>
<input type="text" class="text" id="password" name="password" placeholder="Contraseña" >
<p>{{ $errors->first('password') }}</p>
{{ Form::submit('Ingresar', array('class' => 'bg1')) }}
{{ Form::close() }}
Route
Route::post('usuario', array('as' => 'usuario', 'uses' => 'UsuarioController@doLogin'));
Model
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class Usuario extends Eloquent implements UserInterface, RemindableInterface{
protected $table = 'Usuario';
protected $primaryKey = 'idUsuario';
protected $hidden = array('Contrasena');
protected $fillable = array(
'Nombre',
'Apellido',
'Tipo',
'Contrasena',
'Correo',
'Fono',
'Foto'
);
}
Controller
class UsuarioController extends BaseController{
public function doLogin(){
$rules = array(
'email' => 'required|email',
'password' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
if($validator->fails()){
return Redirect::to('usuario')->withErrors($validator)->withInput(Input::except('password'));
}else{
$userdata = array(
'Correo' => Input::get('email'),
'Password' => Input::get('password')
);
if(Auth::attemp($userdata)){
return View::make('hello');
}else{
return Redirect::to('usuario');
}
}
}
}
Auth
'driver' => 'database',
'model' => 'Usuario',
'table' => 'Usuario',
please, how can I fix it?