Skip to content

Commit

Permalink
avoid login error meassage information leak
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriWahl committed Oct 12, 2022
1 parent 1500555 commit 8943b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions doko3000/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ACCEPTED_JSON_MIMETYPES = ['*/*', 'text/javascript', 'application/json']

MESSAGE_LOGIN_FAILURE = "Login-Fehler"

def is_xhr(request):
"""
Expand Down
7 changes: 4 additions & 3 deletions doko3000/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from .game import Deck, \
Game
from .misc import get_hash, \
is_xhr
is_xhr, \
MESSAGE_LOGIN_FAILURE

# needed for ajax detection
ACCEPTED_JSON_MIMETYPES = ['*/*', 'text/javascript', 'application/json']
Expand Down Expand Up @@ -995,12 +996,12 @@ def login():
player = game.get_player(request.values['name'])
if player:
if not player.check_password(request.values['password']):
flash('Falsches Passwort :-(')
flash(MESSAGE_LOGIN_FAILURE)
else:
login_user(player, remember=True)
return redirect(url_for('index'))
else:
flash('Spieler nicht bekannt :-(')
flash(MESSAGE_LOGIN_FAILURE)
# got to login if not logged in
return render_template('login.html',
title=f"{app.config['TITLE']} Login")
Expand Down

0 comments on commit 8943b64

Please sign in to comment.