在Laravel 5.4中,auth尝试失败

时间:2017-02-23 17:53:38

标签: laravel-5

我有一些关于auth尝试失败的帖子,但我的情况似乎有所不同。仍处于开发阶段,所以我的密码是纯文本。我尝试登录,但我一直变错,所以重定向回登录页面。

错误消息显示用户名/密码不匹配,但dd显示电子邮件和密码均正确无误。

可能导致这次失败的原因是什么? PS:这是我第一次使用laravel

web.php

Route::post('/login', 'AuthController@authenticate');
Route::get('/', 'PostController@index');

AuthController

public function auth()
{
    //dd($request);

    // attempt to login the user
    if (! auth()->attempt(request(['email', 'password']))) {

        return back()->withErrors([
            'message' => 'Username/Password does not macth'
        ]);
    }

    return redirect('/');
}

PostController中

public function index()
{
    $posts = Post::latest()->limit(3)->get();

    return view('post.index', compact('posts'));
}

0 个答案:

没有答案