Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.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
Laravel 4 Laravel Auth是否有直观的错误消息?_Laravel 4 - Fatal编程技术网

Laravel 4 Laravel Auth是否有直观的错误消息?

Laravel 4 Laravel Auth是否有直观的错误消息?,laravel-4,Laravel 4,我正在使用Laravel的内置Auth实现身份验证 我已经看过了教程和S.O.板 他们推荐各种方法来设置验证,但我还没有看到一种方法引用了Auth脚本中的本机错误来解释Auth失败的原因 我在Auth中也找不到它们 通过该应用程序,我在vendor/laravel/framework/src/illumb/auth/console/stubs/controller.stub中找到了以下内容 /** * Handle a POST request to reset a user's p

我正在使用Laravel的内置Auth实现身份验证

我已经看过了教程和S.O.板

他们推荐各种方法来设置验证,但我还没有看到一种方法引用了Auth脚本中的本机错误来解释Auth失败的原因

我在Auth中也找不到它们


通过该应用程序,我在vendor/laravel/framework/src/illumb/auth/console/stubs/controller.stub中找到了以下内容

    /**
 * Handle a POST request to reset a user's password.
 *
 * @return Response
 */
public function postReset()
{
    $credentials = Input::only(
        'email', 'password', 'password_confirmation', 'token'
    );

    $response = Password::reset($credentials, function($user, $password)
    {
        $user->password = Hash::make($password);

        $user->save();
    });

    switch ($response)
    {
        case Password::INVALID_PASSWORD:
        case Password::INVALID_TOKEN:
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));

        case Password::PASSWORD_RESET:
            return Redirect::to('/');
    }
}

正在基于此构建实现。

没有具体的消息。身份验证将通过或失败

if (Auth::attempt($credentials))
{
    // Authentication succeeded!
}
else
{
    // Invalid credentials.
}

因此,您不能明确告诉用户是他们的用户名不正确。

可以扩展Auth来描述失败的原因吗?