Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.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身份验证失败_Php_Authentication_Laravel - Fatal编程技术网

Php Laravel身份验证失败

Php Laravel身份验证失败,php,authentication,laravel,Php,Authentication,Laravel,我或多或少地研究过Laravel的基本用户身份验证。我能找到的所有东西都符合教程,以及我能找到的关于这个主题的每一篇文章和问题,但我的身份验证仍然失败 我已确保使用正确的电子邮件和密码。您可以访问进行注册,如果愿意,然后登录。它当前正在显示电子邮件和密码,作为身份验证错误消息的一部分 用户创建代码为: public function postCreate() { $validator = Validator::make(Input::all(), User::$rules);

我或多或少地研究过Laravel的基本用户身份验证。我能找到的所有东西都符合教程,以及我能找到的关于这个主题的每一篇文章和问题,但我的身份验证仍然失败

我已确保使用正确的电子邮件和密码。您可以访问进行注册,如果愿意,然后登录。它当前正在显示电子邮件和密码,作为身份验证错误消息的一部分

用户创建代码为:

public function postCreate() {
        $validator = Validator::make(Input::all(), User::$rules);

        if ($validator->passes()) {
            // Validation has passed, save the user in the database
            $user = new User;
            $user->username = Input::get('username');
            $user->firstname = Input::get('firstname');
            $user->lastname = Input::get('lastname');
            $user->email = Input::get('email');
            $user->password = Hash::make(Input::get('password'));
            $user->save();

            return Redirect::to('/')->with('message', 'Thanks for registering!');
        } else {
            // Validation has failed, display error messages
            return Redirect::to('users/register')->with('message', 'The following errors occurred . ' . $validator->messages())->withErrors($validator)->withInput();
        }
    }
public function postSignin() {
        $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));

        if (Auth::attempt($credentials)) {
            return Redirect::to('users/dashboard');
        } else {
            return Redirect::to('users/login')->with('message', 'Your username/password combination was incorrect ' . Input::get('email') . ' ' . Input::get('password'))
                ->withInput();
        }
    }
实际登录代码为:

public function postCreate() {
        $validator = Validator::make(Input::all(), User::$rules);

        if ($validator->passes()) {
            // Validation has passed, save the user in the database
            $user = new User;
            $user->username = Input::get('username');
            $user->firstname = Input::get('firstname');
            $user->lastname = Input::get('lastname');
            $user->email = Input::get('email');
            $user->password = Hash::make(Input::get('password'));
            $user->save();

            return Redirect::to('/')->with('message', 'Thanks for registering!');
        } else {
            // Validation has failed, display error messages
            return Redirect::to('users/register')->with('message', 'The following errors occurred . ' . $validator->messages())->withErrors($validator)->withInput();
        }
    }
public function postSignin() {
        $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));

        if (Auth::attempt($credentials)) {
            return Redirect::to('users/dashboard');
        } else {
            return Redirect::to('users/login')->with('message', 'Your username/password combination was incorrect ' . Input::get('email') . ' ' . Input::get('password'))
                ->withInput();
        }
    }
当我尝试登录时给出的错误是一个简单的“您的用户名/密码组合不正确”

我已经检查以确保进入数据库的信息是正确的。例如,这是当前的用户表:


检查数据库中的密码字段是否为60个字符长。Laravel生成的密码散列为60个字符

如果需要,我可以发布代码,但我不认为这是上述问题的重复,因为我没有删除或修改用户模型的任何方法。我还尝试了
php artisan键:generate
,该键已成功完成。然后我创建了一个新用户并尝试登录,但没有成功。我没有说它是重复的,我发布了它,如果它对您有帮助:-)