diff --git a/app.py b/app.py index 69f3159..32d7e33 100644 --- a/app.py +++ b/app.py @@ -199,6 +199,9 @@ def create_app(config=Config): def dashboard(): if request.method == 'GET': 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')) if not current_user.is_admin: pins = list(mongo.db.pins.find({"added_by": current_user.id})) diff --git a/templates/dashboard.html b/templates/dashboard.html index e014756..6d43849 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,5 +1,7 @@ {% extends 'secondbase.html' %} {% block content %} + +

Hola {{current_user.username}}

-

Tu link de invitación es:

-

https://baches.qro.mx/registrame/{{current_user.referral_code}}

+

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.

+
+
+ +

Tu link es:

+

https://baches.qro.mx/registrame/{{current_user.referral_code}}

{% if pins %} {% for pin in pins %}