New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check if user exceeded attempt of logins #36

Merged
merged 5 commits into from Jan 23, 2019

Conversation

Projects
None yet
2 participants
@leportella
Copy link
Collaborator

leportella commented Jan 18, 2019

Closes #21

  • Create functions that sees if user is blocked and adds number of failed tries
  • Block user from login after number of tries
  • Make variables of time and number of attempts optional

@leportella leportella force-pushed the block-user-after-x-failed-logins branch from a3b1f33 to b04f63d Jan 18, 2019

@leportella leportella changed the title [WIP] Add check if user exceeded attempt of logins Add check if user exceeded attempt of logins Jan 21, 2019

@yuvipanda
Copy link
Member

yuvipanda left a comment

One style change, otherwise LGTM!

@@ -25,13 +41,40 @@ def add_new_table(self):
User.info = relationship(UserInfo, backref='users')
UserInfo.__table__.create(self.db.bind)

def exceed_atempts_of_login(self, username):

This comment has been minimized.

@yuvipanda

yuvipanda Jan 23, 2019

Member

This method does two things:

  1. Check if the user has exceeded their limit
  2. Record that the user has attempted a log in

Instead, this should be three functions:

  1. Records that the user has attempted to log in (mutating the dictionary)
  2. Check if the user has exceeded their limit (check the dictionary)
  3. Reset user's entry in dictionary after a successful login

This clearly separates different actions on the data, making it easier to understand in the longer run.

leportella added some commits Jan 18, 2019

Divide responsabilities while checking blocked users
The previous version to check if a user exceeded a number of failed
logins everything was checked in a single method. This commit splits the
responsabilities between 4 functions with small responsabilites each

@leportella leportella force-pushed the block-user-after-x-failed-logins branch from eed363c to 3197739 Jan 23, 2019

@yuvipanda yuvipanda merged commit 753c53a into master Jan 23, 2019

1 check passed

ci/circleci: build Your tests passed on CircleCI!
Details
@yuvipanda

This comment has been minimized.

Copy link
Member

yuvipanda commented Jan 23, 2019

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment