Limiting Login Attempts in Yii 2

Hello, how can we limit the login attempts in the Yii 2 basic application. Any extensions that we can use in order to limit the login attemtps made by the users.

Thanks,

Look at yii2-check-login-attempts extension (link). It is ready for use or as it’s quite simple you can easily adjust it for your needs.

Ok, Thanks

I tried installing the extension using composer. Extension got installed and inserted the behaviors function in the login model, and tried to execute the code with wrong username and password, but it gives the error as

SQLSTATE[42S02]: ## Base table or view not found: 1146 Table login_attempt’ doesn’t exist

The SQL being executed was: SELECT * FROM login_attempt WHERE (key=‘85136c79cbf9fe36bb9d05d0639c70c265c18d37’) AND (reset_at > 1693218720)

Look at the Github: usage

You have to run included migration to prepare the table in your database which the extension require. Check if new table do not interfere those in your project:

$this->createTable(
            '{{%login_attempt}}',

Yes migrations were missing. I implemented them

Ok thank you.