|
|
|
@ -56,8 +56,8 @@ def generate_auth_hash(username):
@@ -56,8 +56,8 @@ def generate_auth_hash(username):
|
|
|
|
|
if user.auth_hash: |
|
|
|
|
flash('Auth hash is already generated') |
|
|
|
|
abort(403) |
|
|
|
|
if user.last_login: |
|
|
|
|
flash('After a player has logged in, it is no longer possible to generate a QR code.') |
|
|
|
|
if user.password_hash: |
|
|
|
|
flash('After a player has created a password, it is no longer possible to generate a QR code.') |
|
|
|
|
abort(403) |
|
|
|
|
user.set_auth_hash() |
|
|
|
|
db.session.commit() |
|
|
|
@ -89,8 +89,8 @@ def user_qrcode(auth_hash):
@@ -89,8 +89,8 @@ def user_qrcode(auth_hash):
|
|
|
|
|
user = User.query.filter_by(auth_hash=auth_hash).first_or_404() |
|
|
|
|
if not current_user.owns_game_played_by(user): |
|
|
|
|
abort(403) |
|
|
|
|
if user.last_login: |
|
|
|
|
flash('After a player has logged in, it is no longer possible to request their QR code.') |
|
|
|
|
if user.password_hash: |
|
|
|
|
flash('After a player has created a password, it is no longer possible to request their QR code.') |
|
|
|
|
abort(403) |
|
|
|
|
img = generate_qr_code(url_for('auth.user_hash_login', auth_hash=auth_hash, _external=True)) |
|
|
|
|
return serve_pil_image(img) |
|
|
|
|