php - How to use laravel login failure limit?
怪我咯
怪我咯 2017-05-31 10:33:58
0
3
1538

Limit the number of login failures
If you use Laravel's built-in AuthController class, you can use the IlluminateFoundationAuthThrottlesLogins trait to limit the number of user login failures. By default, users will be unable to log in for one minute after several failed login attempts. This restriction is based on the user's username/email address IP address:

<?php

namespace AppHttpControllersAuth;

use AppUser;use Validator;
use AppHttpControllersController;
use IlluminateFoundationAuthThrottlesLogins;
use IlluminateFoundationAuthAuthenticatesAndRegistersUsers;

class AuthController extends Controller{

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

// AuthController类的其它部分...

}

The document is written like this, I can’t understand it

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
黄舟

A new access frequency limiting middleware has been built into the framework, allowing you to easily limit the number of requests to a route from a given IP address in a specified period of time. For example, to limit an IP address to accessing a route 60 times per minute, you can do this:

Route::get('/api/users', ['middleware' => 'throttle:60,1', function () {
    //
}]);
淡淡烟草味

Thanks for the invitation

Disclaimer: I have not used it

Idea
Refer to the source code ThrottlesLogins
You can introduce the trait and rewrite the hasTooManyLoginAttempts function to achieve the effect.

黄舟

I have recorded videos on actual use and source code interpretation before: https://www.laravist.com/seri...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template