Laravel 5.6有限登录尝试不起作用(Throttles登录)

时间:2018-05-10 14:02:27

标签: php laravel

我想问一下为什么我的限制因素Laravel 5.6中的登录不起作用,已经从laravel看到文档,这里是代码



namespace App\Http\Controllers\Auth;

use Alert;
use App\Http\Controllers\Website\Controller;
use App\Model\User;
use App\Model\Sessions;
use Auth;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Socialite;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
     */

    use AuthenticatesUsers {
        redirectPath as laravelRedirectPath;
    }

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/admin/dashboard';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    function logout(Request $request)
    {
        $this->guard()->logout();

        $request->session()->invalidate();

        return redirect('/login');
    }

    /**
     * Get the post register / login redirect path.
     *
     * @return string
     */
    function redirectPath()
    {
        // Do your logic to flash data to session...
        Alert::info('You have been successfully logged in!');

        // Return the results of the method we are overriding that we aliased.
        return $this->laravelRedirectPath();
    }
}




auth for login我只是使用laravel,我已经在throttleslogins.php中更改



protected function hasTooManyLoginAttempts(Request $request)
    {
        return $this->limiter()->tooManyAttempts(
            $this->throttleKey($request), 5, 3
        );
    }




但它只显示"这些凭据与我们的记录不匹配"经过5次尝试。我的代码有什么问题吗?

0 个答案:

没有答案