Burathar
4 years ago
7 changed files with 92 additions and 61 deletions
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
{% extends "base.html" %} |
||||
{% import 'bootstrap/wtf.html' as wtf %} |
||||
|
||||
{% block app_content %} |
||||
<h1>User</h1> |
||||
This page is is progress, it should enable you to claim a player account using the authhash, as long as the player hasnt logged in yet. |
||||
{% endblock %} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %} |
||||
{% import 'bootstrap/wtf.html' as wtf %} |
||||
|
||||
{% block app_content %} |
||||
<h1>Welcome, {{ user.name }}!</h1> |
||||
<p> |
||||
If you found this page, it probably means someone who is organising a hunt invited you by |
||||
sending a link or QR-code to this page. You can start playing right away, if and if you get |
||||
logged out just visit this page again. However, if you want to be sure other people can't |
||||
steal this account, please set a password. |
||||
</p> |
||||
<a href="{{ url_for('main.index') }}"><button class="btn btn-primary">Set Password</button></a> |
||||
<a href="{{ url_for('auth.user_hash_login', auth_hash=user.auth_hash, login='true') }}"><button class="btn btn-primary">Start Playing!</button></a> |
||||
{% endblock %} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
from io import BytesIO |
||||
import qrcode |
||||
from flask import send_file |
||||
|
||||
def generate_qr_code(url): |
||||
qr = qrcode.QRCode( |
||||
version=None, |
||||
error_correction=qrcode.constants.ERROR_CORRECT_M, |
||||
box_size=30, |
||||
border=4, |
||||
) |
||||
qr.add_data(url) |
||||
qr.make(fit=True) |
||||
return qr.make_image(fill_color='black', back_color='white') |
||||
|
||||
def serve_pil_image(pil_img): |
||||
# Source: https://stackoverflow.com/questions/7877282/how-to-send-image-generated-by-pil-to-browser |
||||
img_io = BytesIO() |
||||
pil_img.save(img_io, 'PNG', quality=70) |
||||
img_io.seek(0) |
||||
return send_file(img_io, mimetype='image/png') |
Loading…
Reference in new issue