Laravel 4 Laravel Auth是否有直观的错误消息?
我正在使用Laravel的内置Auth实现身份验证 我已经看过了教程和S.O.板 他们推荐各种方法来设置验证,但我还没有看到一种方法引用了Auth脚本中的本机错误来解释Auth失败的原因 我在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
通过该应用程序,我在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来描述失败的原因吗?