diff --git a/docs/index.rst b/docs/index.rst
index fec3322..ce1b415 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -14,7 +14,7 @@ Indices and tables
 ==================
 
 .. toctree::
-   :maxdepth: 2
+   :maxdepth: 1
    :caption: Contents:
 
    quickstart
diff --git a/docs/options.rst b/docs/options.rst
index 565a19f..2a33fb7 100644
--- a/docs/options.rst
+++ b/docs/options.rst
@@ -2,7 +2,7 @@ Feature Options
 ===============
 
 Password Strength
-----------------
+-----------------
 
 By default, when a user signs up through Native Authenticator there is no password strength verification. There are two methods that you can add to increase password strength: a verification for commmon passowords and a minimum length of password. 
 
@@ -20,3 +20,19 @@ You can also add a minimum password length that the user must have. To do this a
 .. code-block:: python
 
     c.Authenticator.minimim_password_length = 10
+
+
+Block users after failed logins
+-------------------------------
+
+One thing that can make systems more safe is to block users after a number of failed logins. With Native Authenticator you can add this feature by adding `allowed_failed_logins` on the config file. The default is 0, which means that the system will not block users ever.
+
+.. code-block:: python
+
+    c.Authenticator.allowed_failed_logins = 3
+
+You can also define the number of seconds a user must wait before trying again. The default value is 600 seconds.
+
+.. code-block:: python
+
+    c.Authenticator.secs_before_next_try = 1200
diff --git a/nativeauthenticator/nativeauthenticator.py b/nativeauthenticator/nativeauthenticator.py
index 1f2c1f8..d454a33 100644
--- a/nativeauthenticator/nativeauthenticator.py
+++ b/nativeauthenticator/nativeauthenticator.py
@@ -1,5 +1,6 @@
 import bcrypt
 import os
+from datetime import datetime
 from jupyterhub.auth import Authenticator
 
 from sqlalchemy import inspect
@@ -26,10 +27,23 @@ class NativeAuthenticator(Authenticator):
         help="""Check if the length of the password is at least this size on
         signup"""
     )
+    allowed_failed_logins = Integer(
+        config=True,
+        default=0,
+        help="""Configures the number of failed attempts a user can have
+                before being blocked."""
+    )
+    seconds_before_next_try = Integer(
+        config=True,
+        default=600,
+        help="""Configures the number of seconds a user has to wait
+                after being blocked. Default is 600."""
+    )
 
     def __init__(self, add_new_table=True, *args, **kwargs):
         super().__init__(*args, **kwargs)
 
+        self.login_attempts = dict()
         if add_new_table:
             self.add_new_table()
 
@@ -38,13 +52,57 @@ class NativeAuthenticator(Authenticator):
         if 'users_info' not in inspector.get_table_names():
             UserInfo.__table__.create(self.db.bind)
 
+    def add_login_attempt(self, username):
+        if not self.login_attempts.get(username):
+            self.login_attempts[username] = {'count': 1,
+                                             'time': datetime.now()}
+        else:
+            self.login_attempts[username]['count'] += 1
+            self.login_attempts[username]['time'] = datetime.now()
+
+    def can_try_to_login_again(self, username):
+        login_attempts = self.login_attempts.get(username)
+        if not login_attempts:
+            return True
+
+        time_last_attempt = datetime.now() - login_attempts['time']
+        if time_last_attempt.seconds > self.seconds_before_next_try:
+            return True
+
+        return False
+
+    def is_blocked(self, username):
+        logins = self.login_attempts.get(username)
+
+        if not logins or logins['count'] < self.allowed_failed_logins:
+            return False
+
+        if self.can_try_to_login_again(username):
+            return False
+        return True
+
+    def successful_login(self, username):
+        if self.login_attempts.get(username):
+            self.login_attempts.pop(username)
+
     @gen.coroutine
     def authenticate(self, handler, data):
-        user = UserInfo.find(self.db, data['username'])
+        username = data['username']
+        password = data['password']
+
+        user = UserInfo.find(self.db, username)
         if not user:
             return
-        if user.is_authorized and user.is_valid_password(data['password']):
-            return data['username']
+
+        if self.allowed_failed_logins:
+            if self.is_blocked(username):
+                return
+
+        if user.is_authorized and user.is_valid_password(password):
+            self.successful_login(username)
+            return username
+
+        self.add_login_attempt(username)
 
     def is_password_common(self, password):
         common_credentials_file = os.path.join(

Block user after X logins failed
- [ ] Allow blocking user from system
- [ ] Add feature on admin panel to set number of trials 
- [ ] Add list of blocked users on admin panel
- [ ] Add verification of number of trials on login
diff --git a/nativeauthenticator/tests/test_authenticator.py b/nativeauthenticator/tests/test_authenticator.py
index 0c025ed..f3b34e0 100644
--- a/nativeauthenticator/tests/test_authenticator.py
+++ b/nativeauthenticator/tests/test_authenticator.py
@@ -1,4 +1,5 @@
 import pytest
+import time
 from jupyterhub.tests.mocking import MockHub
 
 from nativeauthenticator import NativeAuthenticator
@@ -72,3 +73,54 @@ async def test_handlers(app):
     handlers = auth.get_handlers(app)
     assert handlers[1][0] == '/signup'
     assert handlers[2][0] == '/authorize'
+
+
+async def test_add_new_attempt_of_login(tmpcwd, app):
+    auth = NativeAuthenticator(db=app.db)
+
+    assert not auth.login_attempts
+    auth.add_login_attempt('username')
+    assert auth.login_attempts['username']['count'] == 1
+    auth.add_login_attempt('username')
+    assert auth.login_attempts['username']['count'] == 2
+
+
+async def test_authentication_login_count(tmpcwd, app):
+    auth = NativeAuthenticator(db=app.db)
+    infos = {'username': 'johnsnow', 'password': 'password'}
+    wrong_infos = {'username': 'johnsnow', 'password': 'wrong_password'}
+    auth.get_or_create_user(infos['username'], infos['password'])
+    UserInfo.change_authorization(app.db, 'johnsnow')
+
+    assert not auth.login_attempts
+
+    await auth.authenticate(app, wrong_infos)
+    assert auth.login_attempts['johnsnow']['count'] == 1
+
+    await auth.authenticate(app, wrong_infos)
+    assert auth.login_attempts['johnsnow']['count'] == 2
+
+    await auth.authenticate(app, infos)
+    assert not auth.login_attempts.get('johnsnow')
+
+
+async def test_authentication_with_exceed_atempts_of_login(tmpcwd, app):
+    auth = NativeAuthenticator(db=app.db)
+    auth.allowed_failed_logins = 3
+    auth.secs_before_next_try = 10
+
+    infos = {'username': 'John Snow', 'password': 'wrongpassword'}
+    auth.get_or_create_user(infos['username'], 'password')
+    UserInfo.change_authorization(app.db, 'John Snow')
+
+    for i in range(3):
+        response = await auth.authenticate(app, infos)
+        assert not response
+
+    infos['password'] = 'password'
+    response = await auth.authenticate(app, infos)
+    assert not response
+
+    time.sleep(12)
+    response = await auth.authenticate(app, infos)
+    assert response

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-asyncio
apt-get update apt-get install -y gcc
3.7
dev-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alembic==1.12.1
async-generator==1.10
attrs==24.2.0
backcall==0.2.0
bcrypt==4.2.1
beautifulsoup4==4.13.3
bleach==6.0.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
certipy==0.2.2
cffi==1.15.1
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.2.7
cryptography==44.0.2
debugpy==1.7.0
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
exceptiongroup==1.2.2
fastjsonschema==2.21.1
flake8==5.0.4
greenlet==3.1.1
idna==3.10
importlib-metadata==4.2.0
importlib-resources==5.12.0
iniconfig==2.0.0
ipykernel==6.16.2
ipython==7.34.0
ipython-genutils==0.2.0
jedi==0.19.2
Jinja2==3.1.6
jsonschema==4.17.3
jupyter-telemetry==0.1.0
jupyter_client==7.4.9
jupyter_core==4.12.0
jupyterhub==4.1.6
-e git+https://github.com/jupyterhub/nativeauthenticator.git@e2e78301d0731dabbf229217c80312936359ce67#egg=jupyterhub_nativeauthenticator
jupyterlab-pygments==0.2.2
Mako==1.2.4
MarkupSafe==2.1.5
matplotlib-inline==0.1.6
mccabe==0.7.0
mistune==3.0.2
nbclient==0.7.4
nbconvert==7.6.0
nbformat==5.8.0
nest-asyncio==1.6.0
notebook==5.7.2
oauthlib==3.2.2
packaging==24.0
pamela==1.2.0
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pkgutil_resolve_name==1.3.10
pluggy==1.2.0
prometheus-client==0.17.1
prompt_toolkit==3.0.48
psutil==7.0.0
ptyprocess==0.7.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.17.2
pyrsistent==0.19.3
pytest==7.4.4
pytest-asyncio==0.21.2
python-dateutil==2.9.0.post0
python-json-logger==3.0.1
pyzmq==26.2.1
requests==2.31.0
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.8
Send2Trash==1.8.3
six==1.17.0
soupsieve==2.4.1
SQLAlchemy==2.0.40
terminado==0.17.1
tinycss2==1.2.1
tomli==2.0.1
tornado==6.2
traitlets==5.9.0
typing_extensions==4.7.1
urllib3==2.0.7
wcwidth==0.2.13
webencodings==0.5.1
zipp==3.15.0

name: nativeauthenticator
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alembic==1.12.1
      - async-generator==1.10
      - attrs==24.2.0
      - backcall==0.2.0
      - bcrypt==4.2.1
      - beautifulsoup4==4.13.3
      - bleach==6.0.0
      - certipy==0.2.2
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - coverage==7.2.7
      - cryptography==44.0.2
      - debugpy==1.7.0
      - decorator==5.1.1
      - defusedxml==0.7.1
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - fastjsonschema==2.21.1
      - flake8==5.0.4
      - greenlet==3.1.1
      - idna==3.10
      - importlib-metadata==4.2.0
      - importlib-resources==5.12.0
      - iniconfig==2.0.0
      - ipykernel==6.16.2
      - ipython==7.34.0
      - ipython-genutils==0.2.0
      - jedi==0.19.2
      - jinja2==3.1.6
      - jsonschema==4.17.3
      - jupyter-client==7.4.9
      - jupyter-core==4.12.0
      - jupyter-telemetry==0.1.0
      - jupyterhub==4.1.6
      - jupyterlab-pygments==0.2.2
      - mako==1.2.4
      - markupsafe==2.1.5
      - matplotlib-inline==0.1.6
      - mccabe==0.7.0
      - mistune==3.0.2
      - nbclient==0.7.4
      - nbconvert==7.6.0
      - nbformat==5.8.0
      - nest-asyncio==1.6.0
      - notebook==5.7.2
      - oauthlib==3.2.2
      - packaging==24.0
      - pamela==1.2.0
      - pandocfilters==1.5.1
      - parso==0.8.4
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pkgutil-resolve-name==1.3.10
      - pluggy==1.2.0
      - prometheus-client==0.17.1
      - prompt-toolkit==3.0.48
      - psutil==7.0.0
      - ptyprocess==0.7.0
      - pycodestyle==2.9.1
      - pycparser==2.21
      - pyflakes==2.5.0
      - pygments==2.17.2
      - pyrsistent==0.19.3
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - python-dateutil==2.9.0.post0
      - python-json-logger==3.0.1
      - pyzmq==26.2.1
      - requests==2.31.0
      - ruamel-yaml==0.18.10
      - ruamel-yaml-clib==0.2.8
      - send2trash==1.8.3
      - six==1.17.0
      - soupsieve==2.4.1
      - sqlalchemy==2.0.40
      - terminado==0.17.1
      - tinycss2==1.2.1
      - tomli==2.0.1
      - tornado==6.2
      - traitlets==5.9.0
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - zipp==3.15.0
prefix: /opt/conda/envs/nativeauthenticator

nativeauthenticator/tests/test_authenticator.py::test_add_new_attempt_of_login nativeauthenticator/tests/test_authenticator.py::test_authentication_login_count nativeauthenticator/tests/test_authenticator.py::test_authentication_with_exceed_atempts_of_login
nativeauthenticator/tests/test_authenticator.py::test_create_user nativeauthenticator/tests/test_authenticator.py::test_create_user_with_strong_passwords[qwerty-1-False] nativeauthenticator/tests/test_authenticator.py::test_create_user_with_strong_passwords[agameofthrones-1-True] nativeauthenticator/tests/test_authenticator.py::test_create_user_with_strong_passwords[agameofthrones-15-False] nativeauthenticator/tests/test_authenticator.py::test_create_user_with_strong_passwords[averyveryverylongpassword-15-True] nativeauthenticator/tests/test_authenticator.py::test_authentication[name-123-False-False] nativeauthenticator/tests/test_authenticator.py::test_authentication[John nativeauthenticator/tests/test_authenticator.py::test_authentication[Snow-password-True-False] nativeauthenticator/tests/test_authenticator.py::test_handlers
docs/index.rst docs/options.rst nativeauthenticator/nativeauthenticator.py
docs/index.rst docs/options.rst nativeauthenticator/nativeauthenticator.py