From 76db670927e5365ad5ab01df29fe93873e49e36c Mon Sep 17 00:00:00 2001
From: Flavio Tarsetti <flavio.tarsetti@idiap.ch>
Date: Sat, 2 May 2020 03:18:45 +0200
Subject: [PATCH] [accounts][management][commands] send temporary link for
 yearly revalidation users

---
 .../accounts/management/commands/year_revalidation_users.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/beat/web/accounts/management/commands/year_revalidation_users.py b/beat/web/accounts/management/commands/year_revalidation_users.py
index 7b64087d2..90ae93b17 100644
--- a/beat/web/accounts/management/commands/year_revalidation_users.py
+++ b/beat/web/accounts/management/commands/year_revalidation_users.py
@@ -40,6 +40,7 @@ from django.template import loader
 
 from ...models import SupervisionTrack
 from ...models import Profile
+from ...models import TemporaryUrl
 from ....ui.registration.models import RegistrationProfile
 from ....utils import mail
 
@@ -210,9 +211,14 @@ class Command(BaseCommand):
                                     if supervisiontrack.expiration_date.date() - now.date() == datetime.timedelta(days=expiration_reminder):
                                         warned_count += 1
 
+                                        temp_url = TemporaryUrl()
+                                        temp_url._generate_temporary_url(TemporaryUrl.YEARREVALIDATION, supervisiontrack)
+
                                         context = {
                                             'user': user,
                                             'expiration_date': supervisiontrack.expiration_date.date(),
+                                            "prefix": server_address,
+                                            "temp_url": temp_url.url_hash,
                                         }
 
                                         mail.send_email('registration/mail.account_revalidation.subject.txt',
-- 
GitLab