diff --git a/api/locale/fi/LC_MESSAGES/django.po b/api/locale/fi/LC_MESSAGES/django.po index cf7f13c0..e59347b2 100644 --- a/api/locale/fi/LC_MESSAGES/django.po +++ b/api/locale/fi/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-01 18:23+0200\n" +"POT-Creation-Date: 2025-02-02 14:59+0000\n" "PO-Revision-Date: 2020-12-01 18:28+0200\n" "Last-Translator: Sami Olmari \n" "Language-Team: \n" @@ -17,6 +17,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.4.2\n" +"X-Language: fi\n" +"X-Source-Language: en\n" #: api/models.py:19 msgid "User creation date" @@ -90,5 +92,13 @@ msgstr "Varaaja" msgid "Who claimed this entry" msgstr "Kuka varasi tämän merkinnän" +#: api/models.py:90 +msgid "Method" +msgstr "Tapa" + +#: api/models.py:91 +msgid "Method of device access" +msgstr "Kirjautumistapa" + #~ msgid "User who claimed this" #~ msgstr "Käyttäjä joka haltuunotti tämän" diff --git a/api/migrations/0007_deviceaccesslogentry_method.py b/api/migrations/0007_deviceaccesslogentry_method.py new file mode 100644 index 00000000..0a0e48c8 --- /dev/null +++ b/api/migrations/0007_deviceaccesslogentry_method.py @@ -0,0 +1,23 @@ +# Generated by Django 5.1.5 on 2025-02-02 14:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("api", "0006_auto_20201201_1558"), + ] + + operations = [ + migrations.AddField( + model_name="deviceaccesslogentry", + name="method", + field=models.CharField( + default="", + help_text="Method of device access", + max_length=64, + verbose_name="Method", + ), + ), + ] diff --git a/api/models.py b/api/models.py index a6dc35dc..61974529 100644 --- a/api/models.py +++ b/api/models.py @@ -84,3 +84,11 @@ class DeviceAccessLogEntry(models.Model): help_text=_("Who claimed this entry"), on_delete=models.SET_NULL, ) + + method = models.CharField( + blank=False, + verbose_name=_("Method"), + help_text=_("Method of device access"), + default="", + max_length=64, + ) diff --git a/api/views.py b/api/views.py index b18f2254..e07e8e29 100644 --- a/api/views.py +++ b/api/views.py @@ -75,6 +75,7 @@ def access_token_abstraction(self, request, format, method): logentry.device = device logentry.payload = access_token + logentry.method = method # 0 = success, any other = failure response_status = 0 diff --git a/www/locale/fi/LC_MESSAGES/django.po b/www/locale/fi/LC_MESSAGES/django.po index dd02a756..3294ea33 100644 --- a/www/locale/fi/LC_MESSAGES/django.po +++ b/www/locale/fi/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-01 17:19+0000\n" +"POT-Creation-Date: 2025-02-02 14:59+0000\n" "PO-Revision-Date: 2020-12-01 18:35+0200\n" "Last-Translator: Sami Olmari \n" "Language-Team: \n" @@ -32,44 +32,44 @@ msgstr "Jäsenpalvelut" msgid "You must select at least one service" msgstr "Valitse vähintään yksi jäsenpalvelu" -#: www/forms.py:92 +#: www/forms.py:91 #, python-format msgid "%(servicename)s, %(cost)s" msgstr "%(servicename)s, %(cost)s" -#: www/forms.py:100 www/templates/www/custominvoice.html:32 +#: www/forms.py:99 www/templates/www/custominvoice.html:32 #: www/templates/www/custominvoice.html:55 www/templates/www/user.html:136 #: www/templates/www/usersettings.html:51 msgid "Service" msgstr "Jäsenpalvelu" -#: www/forms.py:102 +#: www/forms.py:101 msgid "Choose service.." msgstr "Valitse palvelu.." -#: www/forms.py:105 +#: www/forms.py:104 msgid "How many units of service you want" msgstr "Montako kertaa haluat maksaa palvelun" -#: www/forms.py:108 +#: www/forms.py:107 msgid "Price per unit" msgstr "Hinta per yksikkö" -#: www/forms.py:109 +#: www/forms.py:108 msgid "See price from the service selected above" msgstr "Katso hinta valitusta palvelusta yllä" -#: www/forms.py:124 +#: www/forms.py:123 #, python-format msgid "Price cannot be above service max cost: %(max)s" msgstr "Hinta ei voi olla yli maksimin: %(max)s" -#: www/forms.py:129 +#: www/forms.py:128 #, python-format msgid "Cost cannot be below service min cost: %(min)s" msgstr "Hinta ei voi olla alle minimin: %(min)s" -#: www/forms.py:135 +#: www/forms.py:134 #, python-format msgid "Price must be the service cost: %(cost)s" msgstr "Hinnan pitää olla palvelun hinta: %(cost)s" @@ -78,7 +78,7 @@ msgstr "Hinnan pitää olla palvelun hinta: %(cost)s" #: www/templates/registration/login.html:11 #: www/templates/registration/login.html:21 #: www/templates/registration/password_reset_complete.html:15 -#: www/templates/www/base.html:52 +#: www/templates/www/base.html:53 msgid "Log in" msgstr "Kirjaudu sisään" @@ -254,31 +254,35 @@ msgstr "Tiliote" msgid "Custom invoices" msgstr "Vapaamuotoiset laskut" -#: www/templates/www/base.html:43 +#: www/templates/www/base.html:41 +msgid "Django Admin" +msgstr "Djangon ylläpitokäyttöliittymä" + +#: www/templates/www/base.html:44 msgid "Apply membership" msgstr "Hae jäsenyyttä" -#: www/templates/www/base.html:50 +#: www/templates/www/base.html:51 msgid "log out" msgstr "kirjaudu ulos" -#: www/templates/www/base.html:59 +#: www/templates/www/base.html:60 msgid "Language" msgstr "Kieli" -#: www/templates/www/base.html:86 +#: www/templates/www/base.html:87 msgid "Privacy policy" msgstr "Tietosuojakäytäntö" -#: www/templates/www/base.html:87 +#: www/templates/www/base.html:88 msgid "Report bugs at" msgstr "Raportoi bugit ja osallistu projektiin" -#: www/templates/www/base.html:87 +#: www/templates/www/base.html:88 msgid "GitHub" msgstr "GitHub" -#: www/templates/www/base.html:88 +#: www/templates/www/base.html:89 msgid "View changelog" msgstr "Katso muutoslokia" @@ -729,45 +733,45 @@ msgstr "" "Jos sinulla on kysyttävää tai haluat muuttaa jotain mitä ei ole saatavilla " "täällä, voit lähettää ehdotuksen sähköpostilla." -#: www/views.py:197 +#: www/views.py:195 #, python-format msgid "Rejected member application from %(name)s" msgstr "Hylätty %(name)s:n jäsenhakemus" -#: www/views.py:202 +#: www/views.py:200 #, python-format msgid "Accepted member application from %(name)s" msgstr "Hyväksytty %(name)sn jäsenhakemus" -#: www/views.py:255 +#: www/views.py:253 msgid "User details saved" msgstr "Käyttäjän tiedot tallennettu" -#: www/views.py:310 +#: www/views.py:309 msgid "Welcome to member's Matrix space" msgstr "Tervetuloa jäsenten Matrix-tilaan" -#: www/views.py:311 +#: www/views.py:310 msgid "You have been invited" msgstr "Sinut on nyt kutsuttu" -#: www/views.py:330 +#: www/views.py:329 msgid "You already have this service" msgstr "Sinulla on jo tämä jäsenpalvelu" -#: www/views.py:333 +#: www/views.py:332 msgid "This service cannot be self subscribed to" msgstr "Tätä palvelua ei voi ottaa käyttöön itsepalveluna" -#: www/views.py:341 +#: www/views.py:340 msgid "Service subscribed. You may now pay for it." msgstr "Palvelu otettu käyttöön. Ole hyvä ja maksa se seuraavaksi." -#: www/views.py:361 +#: www/views.py:360 msgid "Service unsubscribed" msgstr "Palvelu poistettu käytöstä" -#: www/views.py:366 +#: www/views.py:365 msgid "" "Service is not active. You must pay for the service first. Contact staff if " "needed." @@ -775,7 +779,7 @@ msgstr "" "Palvelu ei ole aktiivinen. Maksa se ensin. Ota yhtes hallitukseen jos on " "kysyttävää." -#: www/views.py:398 +#: www/views.py:397 msgid "NFC Card successfully claimed" msgstr "NFC-Kortti varattu onnistuneesti" diff --git a/www/tests.py b/www/tests.py index dac5b1a7..b4f28d23 100644 --- a/www/tests.py +++ b/www/tests.py @@ -403,6 +403,7 @@ def test_nfc(self): logentry = DeviceAccessLogEntry() logentry.payload = "1234567" logentry.device = device + logentry.method = "nfc" logentry.granted = False logentry.save() diff --git a/www/views.py b/www/views.py index 4684090f..cfea3d5e 100644 --- a/www/views.py +++ b/www/views.py @@ -273,6 +273,7 @@ def usersettings(request, id): granted=False, nfccard=None, claimed_by=None, + method='nfc', date__gte=timezone.now() - timedelta(minutes=5), ) .exclude(payload__isnull=True)