Authentication Laravel 4身份验证不起作用,并且没有给出任何错误

Authentication Laravel 4身份验证不起作用,并且没有给出任何错误,authentication,laravel,login,blade,Authentication,Laravel,Login,Blade,我一直在寻找解决方案,不断地修改代码,但没有任何东西对我有效,我真的放弃了自己修复代码的希望。 它保持在同一页上,并且不重定向::到('test2'),但保持在同一页上,当我删除否则{return Redirect::to('login'),它会给我一个空白页。 任何帮助都将不胜感激 这是我的用户模型文件: protected $fillable=['email', 'password']; protected $table = 'users'; protected $hid

我一直在寻找解决方案,不断地修改代码,但没有任何东西对我有效,我真的放弃了自己修复代码的希望。 它保持在同一页上,并且不
重定向::到('test2')
,但保持在同一页上,当我删除
否则{return Redirect::to('login')
,它会给我一个空白页。 任何帮助都将不胜感激

这是我的用户模型文件:

protected $fillable=['email', 'password'];

    protected $table = 'users';

    protected $hidden = array('password', 'remember_token');

    protected $primaryKey = 'id';

    public static $rules = array(
        'email' => 'required|email',
        'password' => 'required',
    );

    public function getAuthIdentifier()
    {
        return $this->getKey();
    }

    public function getAuthPassword()
    {
        return $this->password;
    }

    public function getReminderEmail()
    {
        return $this->email;
    }
这是我的路由功能:

Route::get('/login', function(){
    return View::make('login');
});

Route::post('/login',  function(){
    $validator = Validator::make(Input::all(), User::$rules);
    if ($validator->fails()) {
        return Redirect::to('login')
            ->withErrors($validator) 
            ->withInput(Input::except('password')); 
    } else {
        $userData = array(
            'email'     => Input::get('email'),
            'password'  => Input::get('password')
        );
        if (Auth::attempt($userData)) {
            return Redirect::to('test2');
            echo 'SUCCESS!';
        } else {
            return Redirect::to('login');
        }
    }

一开始我一直在努力解决这个问题。
1.如果密码列的长度不是60,则不允许您登录。
2.在通过Auth::trument()登录之前,请尝试使用用户的用户名获取用户的数据 然后使用Hash::check()比较密码 试试这个

  Route::post('/login',  function(){
  $validator = Validator::make(Input::all(), User::$rules);
 if ($validator->fails()) {
    return Redirect::to('login')
        ->withErrors($validator) 
        ->withInput(Input::except('password')); 
 } else {

 $email=Input::get('email');
 $user=User::where('email','=',$email)->first();
 $bool=Hash::check('your password for the email',$user->password);
 if(bool)
    {
      if (Auth::attempt(Input::only('email','password')))
       {
          return Redirect::to('test2');
          echo 'SUCCESS!';
       }else{
         return Redirect::to('login');
       }
   }else{
    return echo 'password didn't matche';
  }
}

数据库中存储的密码是否经过哈希处理?是的,它经过哈希处理,并且我的表和注册表表单工作正常。密码是否可能被截断?(密码列的最小长度应为60个字符)我刚刚尝试了许多密码,很长,而且“未加密”密码,但有相同的问题。您能否尝试从数据库复制哈希并执行以下操作:
hash::check('your-password','thehash from your db')
如果返回true,则哈希是正确的。