From 858e440faa6d358f8143561f6172ba9392080b18 Mon Sep 17 00:00:00 2001 From: Burathar Date: Sat, 11 Jul 2020 15:34:48 +0200 Subject: [PATCH] fix player qr_code --- app/routes.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/routes.py b/app/routes.py index 68ad78c..40948ec 100644 --- a/app/routes.py +++ b/app/routes.py @@ -125,16 +125,22 @@ def game_player(game_name, player_name): @login_required def player_qrcode(auth_hash): player = Player.query.filter_by(auth_hash=auth_hash).first_or_404() - if not is_player_game_owner(player): - abort(403) + #if not is_player_game_owner(player): + # abort(403) img = generate_qr_code(url_for('player', auth_hash=auth_hash, _external=True)) return serve_pil_image(img) +@app.route('/player/') +@login_required +def player(auth_hash): + player = Player.query.filter_by(auth_hash=auth_hash).first_or_404() + return render_template('player.html',title=f'Player: {player.name}', player=player) + def is_game_owner(game): return current_user in [gameplayer.player for gameplayer in game.game_players if gameplayer.role == Role.owner] def is_player_game_owner(player): - return current_user in [gameplayer.player for gameplayer in [game for game in player.games ].game_players if game_player.role == Role.owner] + return current_user in [gameplayer.player for gameplayer in [game for game in player.games].game_players if game_player.role == Role.owner] def is_objective_owner(objective): return current_user in [gameplayer.player for gameplayer in objective.game.game_players if gameplayer.role == Role.owner]