Skip to content

Commit

Permalink
Check invalid username from lists in login
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekj117 committed Jun 6, 2020
1 parent 413971d commit 997fed7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion securedrop/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,15 @@ def throttle_login(cls, user):
@classmethod
def login(cls, username, password, token):
# type: (str, str, str) -> Journalist
invalid_usernames = ['deleted']

try:
user = Journalist.query.filter_by(username=username).one()
except NoResultFound:
raise InvalidUsernameException(
"invalid username '{}'".format(username))

if user.username == 'deleted' and user.uuid == 'deleted':
if user.username in invalid_usernames and user.uuid in invalid_usernames:
raise InvalidUsernameException(
"Invalid username '{}'".format(username))

Expand Down

0 comments on commit 997fed7

Please sign in to comment.