Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel Auth返回false_Php_Authentication_Laravel_Laravel 4 - Fatal编程技术网

Php Laravel Auth返回false

Php Laravel Auth返回false,php,authentication,laravel,laravel-4,Php,Authentication,Laravel,Laravel 4,我正在使用Laravels内置的Auth::trunt功能,尝试为我的网站创建登录脚本。但是,Auth::trunt始终返回false。这个问题似乎与其他许多有类似问题的人相似,但是他们收到的答案对我的问题没有帮助/适用。我正在关注YouTube上的Phpacademy教程,我的登录几乎是一字不差的。拉威尔是否修改了Auth::trunt现在的工作方式?任何帮助都将不胜感激。下面是我在my AccountController.php中的登录函数 public function postLogin

我正在使用Laravels内置的
Auth::trunt
功能,尝试为我的网站创建登录脚本。但是,
Auth::trunt
始终返回false。这个问题似乎与其他许多有类似问题的人相似,但是他们收到的答案对我的问题没有帮助/适用。我正在关注YouTube上的Phpacademy教程,我的登录几乎是一字不差的。拉威尔是否修改了
Auth::trunt
现在的工作方式?任何帮助都将不胜感激。下面是我在my AccountController.php中的登录函数

public function postLogin() {

    $validator = Validator::make(Input::all(),
        array(
            'email' => 'required|email',
            'password' => 'required'    
        )
    );

    if($validator->fails()) {
        return Redirect::route('account-login')
                            ->withErrors($validator)
                            ->withInput();
    }

    else {

        $auth = Auth::attempt(array(
            'email' => Input::get('email'),
            'password' => Input::get('password'),
            'active' => 1
        ));

        if($auth) {
            Redirect::intended('/');
        }

        else {
            return Redirect::route('account-login')
                        ->with('global',"Email/password wrong");
        }

    }

    return Redirect::route('account-login')
                        ->with('global',"There was a problem signing you in.");
}
models/User.php

<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

    use UserTrait, RemindableTrait;

    //fillable for the database
    protected $fillable = array('email','password','first-name','last-name','username','city','state','password','password_temp','code','active');

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = array('password', 'remember_token');

    }

?>

我不确定这是否会影响到你,因为你似乎没有使用“记住我”功能,但Laravel在4.1.2版中引入了以下安全功能。
以下是我们中的许多人在完成phpacademy auth教程后运行auth所需的问题/修复的说明。 希望能有帮助


是的,我认为自从phpacademy教程制作以来,Laravel已经更改了一些安全设置。从记忆来看,这只是一件简单的小事,与CSRF保护或其他相关。你能发布这个文件的代码吗?请:
app/models/User.php
@MichaelColeman添加了它