1
0
forked from orson/bachemap

non-working uuid changer line 204

This commit is contained in:
kprftw 2024-09-06 00:07:52 -06:00
parent 02841fcc2e
commit 24a11fc433
2 changed files with 20 additions and 2 deletions

3
app.py
View File

@ -199,6 +199,9 @@ def create_app(config=Config):
def dashboard(): def dashboard():
if request.method == 'GET': if request.method == 'GET':
if not current_user.is_authenticated: if not current_user.is_authenticated:
q_filter = "{'_id': ObjectId(current_user.id)}"
q_op = "{'$set': {'referral_code':str(uuid4())}}"
mongo.db.users.update_one(q_filter, q_op)
return redirect(url_for('thelogin')) return redirect(url_for('thelogin'))
if not current_user.is_admin: if not current_user.is_admin:
pins = list(mongo.db.pins.find({"added_by": current_user.id})) pins = list(mongo.db.pins.find({"added_by": current_user.id}))

View File

@ -1,5 +1,7 @@
{% extends 'secondbase.html' %} {% extends 'secondbase.html' %}
{% block content %} {% block content %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.js"></script>
<style> <style>
main { main {
overflow-y: scroll; overflow-y: scroll;
@ -7,8 +9,21 @@
</style> </style>
<div style="padding-top: 30px;"> <div style="padding-top: 30px;">
<h3>Hola <span style="color: darkgreen;">{{current_user.username}}</span></h3> <h3>Hola <span style="color: darkgreen;">{{current_user.username}}</span></h3>
<h4>Tu link de invitación es:</h4> <p>Aquí puedes ver los pines que has agregado y ver tu enlace/QR de invitación. Cada vez que recargas esta página, tu enlace de invitacón cambia y el anterior se vuelve inválido.</p>
<h4>https://baches.qro.mx/registrame/{{current_user.referral_code}}</h4> <div id="qrgen" style="border-width:5px; border-color:#e6e6fa">
</div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrgen"), {
text: "https://baches.qro.mx/registrame/{{current_user.referral_code}}",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#e6e6fa",
correctLevel : QRCode.CorrectLevel.L
});
</script>
<h3>Tu link es:</h3>
<h2>https://baches.qro.mx/registrame/{{current_user.referral_code}}</h2>
{% if pins %} {% if pins %}
{% for pin in pins %} {% for pin in pins %}