diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index 8eee3063..a7c32f96 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -570,3 +570,10 @@ SPEAKERS_DINNER_ADULT = SpeakersDinnerCat.create( # "Infant must be seated in an adult's lap. " # "No food or beverage service.", # timedelta(hours=1)) + + +# Venueless integration +VENUELESS_URL = os.environ.get('VENUELESS_URL', None) +VENUELESS_AUDIENCE = os.environ.get('VENUELESS_AUDIENCE', "venueless") +VENUELESS_TOKEN_ISSUER = os.environ.get('VENUELESS_TOKEN_ISSUER', "any") +VENUELESS_SECRET = os.environ.get('VENUELESS_SECRET', SECRET_KEY) diff --git a/pinaxcon/templates/symposion/dashboard/_categories.html b/pinaxcon/templates/symposion/dashboard/_categories.html index e90e639f..d9639456 100644 --- a/pinaxcon/templates/symposion/dashboard/_categories.html +++ b/pinaxcon/templates/symposion/dashboard/_categories.html @@ -41,6 +41,18 @@ {% else %} + {% flag "venueless_dashboard" %} +
The conference is now open. Please join us to watch talks and interact with the other delegates.
+ +This is your boarding " @@ -23,9 +23,9 @@ def create_lca2018_template(apps, schema_editor): "phone or on a print out.
\r\n " "\r\n" "Backup Code: {{ code }}
\r\n \r\n") - template = BoardingPassTemplate(label="LCA2018", - from_address="team@lca2018.org", - subject="Your boarding pass for LCA2018, " + template = BoardingPassTemplate(label="LCA2021", + from_address="contact@lca2021.linux.org.au", + subject="Your boarding pass for LCA2021, " "{{ user.attendee.attendeeprofilebase.attendeeprofile.name }}", body=body, html_body=html) diff --git a/vendor/regidesk/regidesk/migrations/0005_auto_20210108_2347.py b/vendor/regidesk/regidesk/migrations/0005_auto_20210108_2347.py new file mode 100644 index 00000000..1b04cfd6 --- /dev/null +++ b/vendor/regidesk/regidesk/migrations/0005_auto_20210108_2347.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.17 on 2021-01-08 23:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('regidesk', '0004_auto_20180121_1140'), + ] + + operations = [ + migrations.AddField( + model_name='checkin', + name='venueless_traits', + field=models.TextField(blank=True, max_length=256, null=True), + ), + migrations.AddField( + model_name='checkin', + name='venueless_user_id', + field=models.TextField(blank=True, max_length=40, null=True), + ), + migrations.AddField( + model_name='checkin', + name='_venueless_token', + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/vendor/regidesk/regidesk/models.py b/vendor/regidesk/regidesk/models.py index b8417ef2..87cce9b0 100644 --- a/vendor/regidesk/regidesk/models.py +++ b/vendor/regidesk/regidesk/models.py @@ -1,12 +1,14 @@ # -*- coding: utf-8 -*- import base64 -from datetime import datetime +import datetime from decimal import Decimal from io import BytesIO +import jwt from django.core.exceptions import ValidationError from django.utils import timezone +from django.conf import settings from django.db import models from django.db.models import Q, F from django.db.models import Case, When, Value @@ -79,6 +81,10 @@ class CheckIn(models.Model): needs_review = models.BooleanField(default=False) review_text = models.TextField(blank=True) + venueless_user_id = models.TextField(max_length=40, null=True, blank=True) + venueless_traits = models.TextField(max_length=256, null=True, blank=True) + _venueless_token = models.TextField(null=True, blank=True) + class Meta: permissions = ( ("view_checkin_details", "Can view the details of other user's checkins"), @@ -143,3 +149,41 @@ class CheckIn(models.Model): self.save() return self._checkin_code_png + + @property + def venueless_token(self): + """Returns the Venueless JWT token for this checkin's code.""" + updated = False + if not self.venueless_user_id: + self.venueless_user_id = self.checkin_code + updated = True + + if not self.venueless_traits: + self.venueless_traits = ".".join(("attendee",)) + updated = True + + if not self._venueless_token: + self._venueless_token = self._generate_venueless_token() + updated = True + + if updated: + self.save() + + return self._venueless_token + + def _generate_venueless_token(self): + """ Generate token for Venueless login """ + + issued_at = datetime.datetime.utcnow() + expiry = settings.LCA_END + datetime.timedelta(days=1) + + payload = { + "iss": settings.VENUELESS_TOKEN_ISSUER, + "aud": settings.VENUELESS_AUDIENCE, + "iat": issued_at, + "exp": expiry, + "uid": self.venueless_user_id, + "traits": self.venueless_traits.split(','), + } + token = jwt.encode(payload, settings.VENUELESS_SECRET, algorithm="HS256") + return token diff --git a/vendor/regidesk/regidesk/templates/regidesk/boardingpass.html b/vendor/regidesk/regidesk/templates/regidesk/boardingpass.html index 21adc3a3..e6e7ab04 100644 --- a/vendor/regidesk/regidesk/templates/regidesk/boardingpass.html +++ b/vendor/regidesk/regidesk/templates/regidesk/boardingpass.html @@ -6,9 +6,9 @@ {% items_purchased as purchased %} {% items_pending as pending %} {% items_purchased 1 as ticket %} -{% total_items_purchased 2 as penguin_dinner_count %} -{% total_items_purchased 3 as speakers_dinner_count %} -{% total_items_purchased 4 as pdns_count %} + + + {% ticket_type as ticket_type %} {% block header_title %} diff --git a/vendor/regidesk/regidesk/templates/regidesk/boardingpass_overview.html b/vendor/regidesk/regidesk/templates/regidesk/boardingpass_overview.html index 86f2f147..a43106f5 100644 --- a/vendor/regidesk/regidesk/templates/regidesk/boardingpass_overview.html +++ b/vendor/regidesk/regidesk/templates/regidesk/boardingpass_overview.html @@ -6,9 +6,9 @@ {% items_purchased as purchased %} {% items_pending as pending %} {% items_purchased 1 as ticket %} -{% total_items_purchased 2 as penguin_dinner_count %} -{% total_items_purchased 3 as speakers_dinner_count %} -{% total_items_purchased 4 as pdns_count %} + + + {% ticket_type as ticket_type %} {% block body_class %}{{ block.super }} review-results{% endblock %} diff --git a/vendor/regidesk/regidesk/templates/regidesk/boardingpass_prepare.html b/vendor/regidesk/regidesk/templates/regidesk/boardingpass_prepare.html index 147a5bf3..60ed7bdf 100644 --- a/vendor/regidesk/regidesk/templates/regidesk/boardingpass_prepare.html +++ b/vendor/regidesk/regidesk/templates/regidesk/boardingpass_prepare.html @@ -6,9 +6,9 @@ {% items_purchased as purchased %} {% items_pending as pending %} {% items_purchased 1 as ticket %} -{% total_items_purchased 2 as penguin_dinner_count %} -{% total_items_purchased 3 as speakers_dinner_count %} -{% total_items_purchased 4 as pdns_count %} + + + {% ticket_type as ticket_type %} diff --git a/vendor/regidesk/regidesk/templates/regidesk/ci_overview.html b/vendor/regidesk/regidesk/templates/regidesk/ci_overview.html index 4aba4d40..441dc632 100644 --- a/vendor/regidesk/regidesk/templates/regidesk/ci_overview.html +++ b/vendor/regidesk/regidesk/templates/regidesk/ci_overview.html @@ -9,10 +9,10 @@ {% items_purchased as purchased %} {% items_pending as pending %} {% items_purchased 1 as ticket %} -{% items_purchased 6 as shirts %} -{% total_items_purchased 3 as penguin_dinner_count %} -{% total_items_purchased 4 as speakers_dinner_count %} -{% total_items_purchased 5 as pdns_count %} + + + + {% ticket_type as ticket_type %} Return to scanning page @@ -36,6 +36,7 @@