From d1953ef24c44e705b481ac5f8d0655896e53c1a9 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 20 Jun 2022 16:44:06 +0300 Subject: [PATCH 1/7] Changed application accept email formatting to html --- .../templates/email_application_accept.html | 18 +++++++++++------- members/views/applications.py | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/members/templates/email_application_accept.html b/members/templates/email_application_accept.html index 902e070..fbcff40 100644 --- a/members/templates/email_application_accept.html +++ b/members/templates/email_application_accept.html @@ -1,11 +1,15 @@ {% load i18n %} -{% trans "Moi" %} {{ first_name }}! -{% trans "Onnittelut! Sinut on hyväksytty Sähköinsinöörikillan jäseneksi." %} +

Moi {{first_name}}!

-{% trans "Käy kurkkaamassa killan nettisivuilta" %} (https://sahkoinsinoorikilta.fi) {% trans "tulevia tapahtumia ja piipahda kiltahuoneella tutustumassa uusiin kiltatovereihisi!" %} +

Onnittelut! Sinut on hyväksytty Sähköinsinöörikillan jäseneksi.

+

+ Käy kurkkaamassa killan + nettisivuilta + tulevia tapahtumia ja piipahda kiltahuoneella tutustumassa uusiin kiltatovereihisi! +

-{% trans "Liity myös killan TG-kanaville" %}: -{% trans "SIK" %}: https://t.me/+ubTeGSYKTvg3NmVk -{% trans "SIK-fuksit 2022" %}: https://t.me/+1PqQHRVMjiAxMTU0 -{% trans "SIK-fuksit 2022 -tiedotuskanava" %}: https://t.me/+Ln8TvQ-_id9kZTU0 +

Liity myös killan TG-kanaville:

+

Killan yleinen telegram

+

SIK-fuksit 2022

+

SIK-fuksit 2022 -tiedotuskanava

diff --git a/members/views/applications.py b/members/views/applications.py index 42fbf2e..dc5f033 100644 --- a/members/views/applications.py +++ b/members/views/applications.py @@ -104,7 +104,7 @@ def application_accept(request, *args, **kwargs): "members:email_application_accept.html", {"first_name": application.first_name}, ) - send_email(member.email, subject, message) + send_email(member.email, subject, message, True) return HttpResponseRedirect( "/members/list?notification={}".format(html.escape(notification)) From 5eef2f685c9662d6266cfd255746ce90752d5220 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 20 Jun 2022 22:17:29 +0300 Subject: [PATCH 2/7] Update pyjwt --- poetry.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/poetry.lock b/poetry.lock index 7c9d21a..05a0e1d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1025,6 +1025,7 @@ et-xmlfile = [ {file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"}, ] gunicorn = [ + {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, ] idna = [ From e70e598c57cb7e2741e992fad78a0ae62865b2d3 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Tue, 21 Jun 2022 21:35:59 +0300 Subject: [PATCH 3/7] #12 Changed djangorestframework-jwt to djangorestframework-simplejwt --- poetry.lock | 74 ++++++++++++++++++++++++++-------------------- pyproject.toml | 4 +-- sikweb/base.py | 4 +-- sikweb/settings.py | 5 ++-- webapp/urls.py | 11 ++++--- 5 files changed, 56 insertions(+), 42 deletions(-) diff --git a/poetry.lock b/poetry.lock index 05a0e1d..a1eeacd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -14,7 +14,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "babel" -version = "2.10.1" +version = "2.10.3" description = "Internationalization utilities" category = "main" optional = false @@ -47,11 +47,11 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2022.5.18" +version = "2022.6.15" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" [[package]] name = "charset-normalizer" @@ -77,7 +77,7 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} [[package]] name = "colorama" -version = "0.4.4" +version = "0.4.5" description = "Cross-platform colored terminal text." category = "dev" optional = false @@ -303,15 +303,24 @@ django = ">=2.2" pytz = "*" [[package]] -name = "djangorestframework-jwt" -version = "1.11.0" -description = "JSON Web Token based authentication for Django REST framework" +name = "djangorestframework-simplejwt" +version = "5.2.0" +description = "A minimal JSON Web Token authentication plugin for Django REST Framework" category = "main" optional = false -python-versions = "*" +python-versions = ">=3.7" [package.dependencies] -PyJWT = ">=1.5.2,<2.0.0" +django = "*" +djangorestframework = "*" +pyjwt = ">=1.7.1,<3" + +[package.extras] +dev = ["pytest-watch", "wheel", "twine", "ipython", "cryptography", "pytest-cov", "pytest-django", "pytest-xdist", "pytest", "tox", "flake8", "pep8", "isort", "Sphinx (>=1.6.5,<2)", "sphinx-rtd-theme (>=0.1.9)", "python-jose (==3.3.0)"] +doc = ["Sphinx (>=1.6.5,<2)", "sphinx-rtd-theme (>=0.1.9)"] +lint = ["flake8", "pep8", "isort"] +python-jose = ["python-jose (==3.3.0)"] +test = ["cryptography", "pytest-cov", "pytest-django", "pytest-xdist", "pytest", "tox"] [[package]] name = "dparse" @@ -361,7 +370,7 @@ python-versions = ">=3.5" [[package]] name = "importlib-metadata" -version = "4.11.3" +version = "4.11.4" description = "Read metadata from Python packages" category = "main" optional = false @@ -482,7 +491,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [[package]] name = "phonenumbers" -version = "8.12.48" +version = "8.12.50" description = "Python version of Google's common library for parsing, formatting, storing and validating international phone numbers." category = "main" optional = false @@ -568,16 +577,17 @@ pyexcel-io = ">=0.5.3" [[package]] name = "pyjwt" -version = "1.7.1" +version = "2.4.0" description = "JSON Web Token implementation in Python" category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" [package.extras] -crypto = ["cryptography (>=1.4)"] -flake8 = ["flake8", "flake8-import-order", "pep8-naming"] -test = ["pytest (>=4.0.1,<5.0.0)", "pytest-cov (>=2.6.0,<3.0.0)", "pytest-runner (>=4.2,<5.0.0)"] +crypto = ["cryptography (>=3.3.1)"] +dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)", "mypy", "pre-commit"] +docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] +tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)"] [[package]] name = "pyparsing" @@ -839,7 +849,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "737b7278d4803532c7b5aee8fa95cabba24a20c70467d58fde5ab6d63c796ecf" +content-hash = "7bd8922d622b0f6a042c5508bb2789bb3fb69df3b3198ae0adca52ce12432887" [metadata.files] attrs = [ @@ -847,8 +857,8 @@ attrs = [ {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, ] babel = [ - {file = "Babel-2.10.1-py3-none-any.whl", hash = "sha256:3f349e85ad3154559ac4930c3918247d319f21910d5ce4b25d439ed8693b98d2"}, - {file = "Babel-2.10.1.tar.gz", hash = "sha256:98aeaca086133efb3e1e2aad0396987490c8425929ddbcfe0550184fdc54cd13"}, + {file = "Babel-2.10.3-py3-none-any.whl", hash = "sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb"}, + {file = "Babel-2.10.3.tar.gz", hash = "sha256:7614553711ee97490f732126dc077f8d0ae084ebc6a96e23db1482afabdb2c51"}, ] black = [ {file = "black-22.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2497f9c2386572e28921fa8bec7be3e51de6801f7459dffd6e62492531c47e09"}, @@ -876,8 +886,8 @@ black = [ {file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"}, ] certifi = [ - {file = "certifi-2022.5.18-py3-none-any.whl", hash = "sha256:8d15a5a7fde18536a249c49e07e8e462b8fc13de21b3c80e8a68315dfa227c99"}, - {file = "certifi-2022.5.18.tar.gz", hash = "sha256:6ae10321df3e464305a46e997da41ea56c1d311fb9ff1dd4e04d6f14653ec63a"}, + {file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"}, + {file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"}, ] charset-normalizer = [ {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, @@ -888,8 +898,8 @@ click = [ {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, ] colorama = [ - {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, - {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, + {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, + {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, ] coverage = [ {file = "coverage-5.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf"}, @@ -1012,9 +1022,9 @@ djangorestframework = [ {file = "djangorestframework-3.13.1-py3-none-any.whl", hash = "sha256:24c4bf58ed7e85d1fe4ba250ab2da926d263cd57d64b03e8dcef0ac683f8b1aa"}, {file = "djangorestframework-3.13.1.tar.gz", hash = "sha256:0c33407ce23acc68eca2a6e46424b008c9c02eceb8cf18581921d0092bc1f2ee"}, ] -djangorestframework-jwt = [ - {file = "djangorestframework-jwt-1.11.0.tar.gz", hash = "sha256:5efe33032f3a4518a300dc51a51c92145ad95fb6f4b272e5aa24701db67936a7"}, - {file = "djangorestframework_jwt-1.11.0-py2.py3-none-any.whl", hash = "sha256:ab15dfbbe535eede8e2e53adaf52ef0cf018ee27dbfad10cbc4cbec2ab63d38c"}, +djangorestframework-simplejwt = [ + {file = "djangorestframework_simplejwt-5.2.0-py3-none-any.whl", hash = "sha256:bcc4cb74dcb637ca1e17eed35276bd618ab19491f8c53e65dee6271177c355e8"}, + {file = "djangorestframework_simplejwt-5.2.0.tar.gz", hash = "sha256:a60b09afb27d91ad1d7ac904cc632bd52cecead8f389f0fa1532ceb0fb757a74"}, ] dparse = [ {file = "dparse-0.5.1-py3-none-any.whl", hash = "sha256:e953a25e44ebb60a5c6efc2add4420c177f1d8404509da88da9729202f306994"}, @@ -1033,8 +1043,8 @@ idna = [ {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.11.3-py3-none-any.whl", hash = "sha256:1208431ca90a8cca1a6b8af391bb53c1a2db74e5d1cef6ddced95d4b2062edc6"}, - {file = "importlib_metadata-4.11.3.tar.gz", hash = "sha256:ea4c597ebf37142f827b8f39299579e31685c31d3a438b59f469406afd0f2539"}, + {file = "importlib_metadata-4.11.4-py3-none-any.whl", hash = "sha256:c58c8eb8a762858f49e18436ff552e83914778e50e9d2f1660535ffb364552ec"}, + {file = "importlib_metadata-4.11.4.tar.gz", hash = "sha256:5d26852efe48c0a32b0509ffbc583fda1a2266545a78d104a6f4aff3db17d700"}, ] jdcal = [ {file = "jdcal-1.4.1-py2.py3-none-any.whl", hash = "sha256:1abf1305fce18b4e8aa248cf8fe0c56ce2032392bc64bbd61b5dff2a19ec8bba"}, @@ -1076,8 +1086,8 @@ pathspec = [ {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, ] phonenumbers = [ - {file = "phonenumbers-8.12.48-py2.py3-none-any.whl", hash = "sha256:429273b98966475d0c18ee293096eaf81c6b5727d0d55c7ba5ce9c60ec8c59ef"}, - {file = "phonenumbers-8.12.48.tar.gz", hash = "sha256:af0681fbfe9fa0721376ad9b729e772e5d20bf2cf50d9dd8ca2f0bdd78e9f0ce"}, + {file = "phonenumbers-8.12.50-py2.py3-none-any.whl", hash = "sha256:56713403b4160b59ea1fef4e842ddeb70931055146d794d371b60cd4b5f05fb8"}, + {file = "phonenumbers-8.12.50.tar.gz", hash = "sha256:f00d67f20875804f4fade4803a9438294029982ac929c6ba303e1f0290cf5d45"}, ] pillow = [ {file = "Pillow-9.1.1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:42dfefbef90eb67c10c45a73a9bc1599d4dac920f7dfcbf4ec6b80cb620757fe"}, @@ -1173,8 +1183,8 @@ pyexcel-xlsx = [ {file = "pyexcel_xlsx-0.5.8-py2.py3-none-any.whl", hash = "sha256:9bae2820c5767440d8a387695e0f8e8f73c97bcde0a5680c200ae82a2f6d5cc6"}, ] pyjwt = [ - {file = "PyJWT-1.7.1-py2.py3-none-any.whl", hash = "sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e"}, - {file = "PyJWT-1.7.1.tar.gz", hash = "sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"}, + {file = "PyJWT-2.4.0-py3-none-any.whl", hash = "sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf"}, + {file = "PyJWT-2.4.0.tar.gz", hash = "sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba"}, ] pyparsing = [ {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, diff --git a/pyproject.toml b/pyproject.toml index 5367382..7fc3cd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,10 +8,9 @@ authors = ["Aarni Halinen aarni.halinen@sahkoinsinoorikilta.fi"] python = "^3.9" decorator = "^4.0.9" Django = "^2.2.19" -requests = "^2.11.1" +requests = "2.27.1" django-cors-headers = "^3.7.0" djangorestframework = "^3.12.4" -djangorestframework-jwt = "^1.11.0" django-nose = "^1.4.5" psycopg2-binary = "2.8.6" django-bootstrap3 = "^11.1.0" @@ -38,6 +37,7 @@ sendgrid = "^6.7.0" sentry-sdk = "^1.4.3" django-polymorphic = "^3.1.0" python-dotenv = "^0.20.0" +djangorestframework-simplejwt = "^5.2.0" [tool.poetry.dev-dependencies] coverage = "^5.5" diff --git a/sikweb/base.py b/sikweb/base.py index d7ca7f6..07c1e0a 100644 --- a/sikweb/base.py +++ b/sikweb/base.py @@ -87,7 +87,7 @@ INSTALLED_APPS = [ "kaehmy", "ohlhafv", "rest_framework", - "rest_framework_jwt", + "rest_framework_simplejwt", "django_nose", "bootstrap3", "django_tables2", @@ -178,7 +178,7 @@ REST_FRAMEWORK = { "rest_framework.permissions.IsAdminUser", ), "DEFAULT_AUTHENTICATION_CLASSES": ( - "rest_framework_jwt.authentication.JSONWebTokenAuthentication", + "rest_framework_simplejwt.authentication.JWTAuthentication", ), # 'DEFAULT_THROTTLE_CLASSES': ( # 'members.throttles.BurstRateThrottle', diff --git a/sikweb/settings.py b/sikweb/settings.py index e81d4de..d85f392 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -14,6 +14,7 @@ from dotenv import load_dotenv import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration from sikweb.base import * +from datetime import timedelta load_dotenv() # loads the configs from .env @@ -61,7 +62,7 @@ DEFAULT_EMAIL_FROM = "SIK" DEFAULT_EMAIL_FROM_ADDR = "noreply@sahkoinsinoorikilta.fi" ENABLE_AUTOMATIC_EMAILS = True -# Database settings +# Database settingsfrom datetime import timedelta # Only uncomment if default settings in base.py are not ok DB_OPTIONS = {"sslmode": "require"} if os.getenv("DB_SSL", False) == "True" else {} @@ -76,4 +77,4 @@ DATABASES = { "PORT": os.getenv("DB_PORT", 5432), "OPTIONS": DB_OPTIONS, } -} +} \ No newline at end of file diff --git a/webapp/urls.py b/webapp/urls.py index adb7af4..c5238f3 100644 --- a/webapp/urls.py +++ b/webapp/urls.py @@ -1,15 +1,15 @@ """Webapp urls.""" from django.conf.urls import url, include +from django.urls import path from rest_framework import routers -from rest_framework_jwt.views import obtain_jwt_token, verify_jwt_token +from rest_framework_simplejwt.views import (TokenObtainPairView, TokenRefreshView) from webapp.views import * class APIRouter(routers.DefaultRouter): APIRootView = RootView - router = APIRouter() router.register(r"events", EventViewSet) router.register(r"signupForm", SignupFormViewSet) @@ -21,7 +21,10 @@ router.register(r"jobads", JobAdViewSet) urlpatterns = [ url(r"^api/", include(router.urls)), - url(r"^api/api-token-auth/", obtain_jwt_token), - url(r"^api/api-token-verify/", verify_jwt_token), + path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), + path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), url(r"^jwt_nginx", nginx_jwt_resp), ] + +# url(r"^api/api-token-auth/", obtain_jwt_token), +# url(r"^api/api-token-verify/", verify_jwt_token), \ No newline at end of file From 337b77407469677174472552541fd52112d6ce4b Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Tue, 21 Jun 2022 21:47:54 +0300 Subject: [PATCH 4/7] lint --- sikweb/settings.py | 2 +- webapp/urls.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sikweb/settings.py b/sikweb/settings.py index d85f392..9b22a24 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -77,4 +77,4 @@ DATABASES = { "PORT": os.getenv("DB_PORT", 5432), "OPTIONS": DB_OPTIONS, } -} \ No newline at end of file +} diff --git a/webapp/urls.py b/webapp/urls.py index c5238f3..3c09100 100644 --- a/webapp/urls.py +++ b/webapp/urls.py @@ -3,13 +3,14 @@ from django.conf.urls import url, include from django.urls import path from rest_framework import routers -from rest_framework_simplejwt.views import (TokenObtainPairView, TokenRefreshView) +from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView from webapp.views import * class APIRouter(routers.DefaultRouter): APIRootView = RootView + router = APIRouter() router.register(r"events", EventViewSet) router.register(r"signupForm", SignupFormViewSet) @@ -21,10 +22,7 @@ router.register(r"jobads", JobAdViewSet) urlpatterns = [ url(r"^api/", include(router.urls)), - path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), - path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), + path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"), + path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"), url(r"^jwt_nginx", nginx_jwt_resp), ] - -# url(r"^api/api-token-auth/", obtain_jwt_token), -# url(r"^api/api-token-verify/", verify_jwt_token), \ No newline at end of file From b3a484ce55297fcaeca36fae17ce85f6c03513bf Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 4 Jul 2022 10:19:40 +0300 Subject: [PATCH 5/7] Added verify path --- sikweb/settings.py | 32 ++++++++++++++++++++++++++++++++ webapp/urls.py | 7 ++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/sikweb/settings.py b/sikweb/settings.py index 9b22a24..821b2e8 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -78,3 +78,35 @@ DATABASES = { "OPTIONS": DB_OPTIONS, } } + +SIMPLE_JWT = { + 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5), + 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), + 'ROTATE_REFRESH_TOKENS': False, + 'BLACKLIST_AFTER_ROTATION': False, + 'UPDATE_LAST_LOGIN': False, + + 'ALGORITHM': 'HS256', + 'SIGNING_KEY': SECRET_KEY, + 'VERIFYING_KEY': None, + 'AUDIENCE': None, + 'ISSUER': None, + 'JWK_URL': None, + 'LEEWAY': 0, + + 'AUTH_HEADER_TYPES': ('Bearer',), + 'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION', + 'USER_ID_FIELD': 'id', + 'USER_ID_CLAIM': 'user_id', + 'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule', + + 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',), + 'TOKEN_TYPE_CLAIM': 'token_type', + 'TOKEN_USER_CLASS': 'rest_framework_simplejwt.models.TokenUser', + + 'JTI_CLAIM': 'jti', + + 'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp', + 'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5), + 'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1), +} diff --git a/webapp/urls.py b/webapp/urls.py index 3c09100..b98b172 100644 --- a/webapp/urls.py +++ b/webapp/urls.py @@ -3,7 +3,7 @@ from django.conf.urls import url, include from django.urls import path from rest_framework import routers -from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView +from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView from webapp.views import * @@ -22,7 +22,8 @@ router.register(r"jobads", JobAdViewSet) urlpatterns = [ url(r"^api/", include(router.urls)), - path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"), - path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"), + path(r"api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"), + path(r"api/token/verify/", TokenVerifyView.as_view(), name='token_verify'), + path(r"api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"), url(r"^jwt_nginx", nginx_jwt_resp), ] From 7319c32d73f301389bde9f4e8fe8001f6f8959b7 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 4 Jul 2022 10:24:53 +0300 Subject: [PATCH 6/7] lint --- sikweb/settings.py | 53 +++++++++++++++++++++------------------------- webapp/urls.py | 8 +++++-- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/sikweb/settings.py b/sikweb/settings.py index 821b2e8..9eca583 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -80,33 +80,28 @@ DATABASES = { } SIMPLE_JWT = { - 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5), - 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), - 'ROTATE_REFRESH_TOKENS': False, - 'BLACKLIST_AFTER_ROTATION': False, - 'UPDATE_LAST_LOGIN': False, - - 'ALGORITHM': 'HS256', - 'SIGNING_KEY': SECRET_KEY, - 'VERIFYING_KEY': None, - 'AUDIENCE': None, - 'ISSUER': None, - 'JWK_URL': None, - 'LEEWAY': 0, - - 'AUTH_HEADER_TYPES': ('Bearer',), - 'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION', - 'USER_ID_FIELD': 'id', - 'USER_ID_CLAIM': 'user_id', - 'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule', - - 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',), - 'TOKEN_TYPE_CLAIM': 'token_type', - 'TOKEN_USER_CLASS': 'rest_framework_simplejwt.models.TokenUser', - - 'JTI_CLAIM': 'jti', - - 'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp', - 'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5), - 'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1), + "ACCESS_TOKEN_LIFETIME": timedelta(minutes=5), + "REFRESH_TOKEN_LIFETIME": timedelta(days=1), + "ROTATE_REFRESH_TOKENS": False, + "BLACKLIST_AFTER_ROTATION": False, + "UPDATE_LAST_LOGIN": False, + "ALGORITHM": "HS256", + "SIGNING_KEY": SECRET_KEY, + "VERIFYING_KEY": None, + "AUDIENCE": None, + "ISSUER": None, + "JWK_URL": None, + "LEEWAY": 0, + "AUTH_HEADER_TYPES": ("Bearer",), + "AUTH_HEADER_NAME": "HTTP_AUTHORIZATION", + "USER_ID_FIELD": "id", + "USER_ID_CLAIM": "user_id", + "USER_AUTHENTICATION_RULE": "rest_framework_simplejwt.authentication.default_user_authentication_rule", + "AUTH_TOKEN_CLASSES": ("rest_framework_simplejwt.tokens.AccessToken",), + "TOKEN_TYPE_CLAIM": "token_type", + "TOKEN_USER_CLASS": "rest_framework_simplejwt.models.TokenUser", + "JTI_CLAIM": "jti", + "SLIDING_TOKEN_REFRESH_EXP_CLAIM": "refresh_exp", + "SLIDING_TOKEN_LIFETIME": timedelta(minutes=5), + "SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=1), } diff --git a/webapp/urls.py b/webapp/urls.py index b98b172..1f9435d 100644 --- a/webapp/urls.py +++ b/webapp/urls.py @@ -3,7 +3,11 @@ from django.conf.urls import url, include from django.urls import path from rest_framework import routers -from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView +from rest_framework_simplejwt.views import ( + TokenObtainPairView, + TokenRefreshView, + TokenVerifyView, +) from webapp.views import * @@ -23,7 +27,7 @@ router.register(r"jobads", JobAdViewSet) urlpatterns = [ url(r"^api/", include(router.urls)), path(r"api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"), - path(r"api/token/verify/", TokenVerifyView.as_view(), name='token_verify'), + path(r"api/token/verify/", TokenVerifyView.as_view(), name="token_verify"), path(r"api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"), url(r"^jwt_nginx", nginx_jwt_resp), ] From fac2f9b367a31db642c08c76ac4b0c9948f315d4 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 4 Jul 2022 10:33:38 +0300 Subject: [PATCH 7/7] Added pre-commit linter, lint --- .pre-commit-config.yaml | 10 ++ infoscreen/static/infoscreen/css/abb.css | 2 +- infoscreen/static/infoscreen/css/apy.css | 4 +- .../static/infoscreen/css/infoscreen.css | 8 +- infoscreen/static/infoscreen/css/sosso.css | 6 +- infoscreen/static/infoscreen/html/events.html | 2 +- infoscreen/templates/tabs/rotations.html | 2 +- kaehmy/templates/export.html | 2 +- kaehmy/templates/list.html | 20 +-- kaehmy/templates/message.html | 2 +- kaehmy/templates/statistics.html | 6 +- members/templates/application_edit.html | 2 +- members/templates/application_list.html | 2 +- members/templates/member_add_many.html | 10 +- members/templates/member_list.html | 2 +- members/templates/payment_list.html | 2 +- members/templates/upload_form.html | 2 +- ohlhafv/templates/list.html | 2 +- poetry.lock | 117 +++++++++++++++++- pyproject.toml | 1 + scripts/db/init.sql | 4 +- .../ng-file-upload-bower-12.2.11/FileAPI.js | 36 +++--- webapp/templates/contact.html | 4 +- 23 files changed, 184 insertions(+), 64 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..cb576af --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + language_version: python3.9 diff --git a/infoscreen/static/infoscreen/css/abb.css b/infoscreen/static/infoscreen/css/abb.css index af6e203..6ef29ca 100644 --- a/infoscreen/static/infoscreen/css/abb.css +++ b/infoscreen/static/infoscreen/css/abb.css @@ -3,7 +3,7 @@ body { } #header:after { - content: " "; + content: " "; display: block; clear: both; } diff --git a/infoscreen/static/infoscreen/css/apy.css b/infoscreen/static/infoscreen/css/apy.css index fce7b61..19f40cd 100644 --- a/infoscreen/static/infoscreen/css/apy.css +++ b/infoscreen/static/infoscreen/css/apy.css @@ -12,7 +12,7 @@ body { .event { font-size: 100px; font-weight: bold; - margin-left: 20px; + margin-left: 20px; } .event-col{ padding-top:1vh; @@ -21,7 +21,7 @@ body { .header-row{ margin: 30px; - margin-left: 20px; + margin-left: 20px; font-size: 130px; padding-bottom:20px; color:#24a05f; diff --git a/infoscreen/static/infoscreen/css/infoscreen.css b/infoscreen/static/infoscreen/css/infoscreen.css index c8f48c5..6968a43 100644 --- a/infoscreen/static/infoscreen/css/infoscreen.css +++ b/infoscreen/static/infoscreen/css/infoscreen.css @@ -1,8 +1,8 @@ #infocontent { - width: 100%; - height: 100%; - position: fixed; - left: 0px; + width: 100%; + height: 100%; + position: fixed; + left: 0px; top: 0px; z-index: -1; /* Ensure div tag stays behind content; -999 might work, too. */ } diff --git a/infoscreen/static/infoscreen/css/sosso.css b/infoscreen/static/infoscreen/css/sosso.css index ad43080..ecf77d0 100644 --- a/infoscreen/static/infoscreen/css/sosso.css +++ b/infoscreen/static/infoscreen/css/sosso.css @@ -31,10 +31,10 @@ max-height 200px; } -#sossoimage { +#sossoimage { height:300px; - position: relative; - left: 0px; + position: relative; + left: 0px; top: 0px; } diff --git a/infoscreen/static/infoscreen/html/events.html b/infoscreen/static/infoscreen/html/events.html index cd73f37..7b0e1b3 100644 --- a/infoscreen/static/infoscreen/html/events.html +++ b/infoscreen/static/infoscreen/html/events.html @@ -1,5 +1,5 @@ - +
Tapahtuma
diff --git a/infoscreen/templates/tabs/rotations.html b/infoscreen/templates/tabs/rotations.html index 2177861..1ed0cf9 100644 --- a/infoscreen/templates/tabs/rotations.html +++ b/infoscreen/templates/tabs/rotations.html @@ -26,7 +26,7 @@

{% trans "Rotation" %}: {$ selected_rot.name $}

- {% trans "Preview" %} + {% trans "Preview" %}
{% trans "Instances in currently selected rotation" %}:
diff --git a/kaehmy/templates/export.html b/kaehmy/templates/export.html index 7fa0682..9cc34b3 100644 --- a/kaehmy/templates/export.html +++ b/kaehmy/templates/export.html @@ -18,7 +18,7 @@

{% trans "Non-board applications" %}

{{ non_board_table|safe }} - + diff --git a/kaehmy/templates/list.html b/kaehmy/templates/list.html index e8ae1da..9a5de8f 100644 --- a/kaehmy/templates/list.html +++ b/kaehmy/templates/list.html @@ -11,11 +11,11 @@ @@ -24,7 +24,7 @@

{% trans "All kaehmys" %}

-
+
{% csrf_token %} @@ -69,18 +69,18 @@
{% trans "Total kaehmys:" %} {{ application_count }}
- + {% for application in applications %}
-

{{ application.name }}

+

{{ application.name }}

{% if application.board_roles|length > 0 %} -
{{ application.board_roles }}
+
{{ application.board_roles }}
{% endif %} {% if application.official_roles|length > 0 %} -
{{ application.official_roles }}
- {% endif %} +
{{ application.official_roles }}
+ {% endif %}

{{ application.text|linebreaks|urlize }}

{% if application.comment_count > 0 %} @@ -95,7 +95,7 @@
-
+
{% for message in application.messages.all %} {% include "kaehmy:message.html" with messages=message.messages.all %} {% endfor %} diff --git a/kaehmy/templates/message.html b/kaehmy/templates/message.html index bee6b97..c766649 100644 --- a/kaehmy/templates/message.html +++ b/kaehmy/templates/message.html @@ -16,6 +16,6 @@ {% include "message.html" with messages=message.messages.all %} {% endfor %}
- +
\ No newline at end of file diff --git a/kaehmy/templates/statistics.html b/kaehmy/templates/statistics.html index fc82859..635bb62 100644 --- a/kaehmy/templates/statistics.html +++ b/kaehmy/templates/statistics.html @@ -10,12 +10,12 @@ {% block content %}
-

{% trans "Statistics" %}

+

{% trans "Statistics" %}

-
{% trans "Total kaehmys:" %} {{ application_count }}
+
{% trans "Total kaehmys:" %} {{ application_count }}
{% for role in role_list %} @@ -25,6 +25,6 @@ {% endfor %}
- +
{% endblock content %} diff --git a/members/templates/application_edit.html b/members/templates/application_edit.html index a342be6..5562af9 100644 --- a/members/templates/application_edit.html +++ b/members/templates/application_edit.html @@ -11,7 +11,7 @@
{% csrf_token %} - + {% bootstrap_form form %} {% buttons %}
diff --git a/members/templates/member_add_many.html b/members/templates/member_add_many.html index 574fbdc..77aa5df 100644 --- a/members/templates/member_add_many.html +++ b/members/templates/member_add_many.html @@ -11,7 +11,7 @@

{% blocktrans %} - Enter member information in CSV format, separate members on separate lines. + Enter member information in CSV format, separate members on separate lines. If a new member already exists in the database, a new payment event will be created for that member instead. {% endblocktrans %}

@@ -20,7 +20,7 @@
- +

{% blocktrans %}Columns: First name, last name, email address, place of origin, AYY member, JAS recipient{% endblocktrans %}

@@ -28,10 +28,10 @@
- + {% csrf_token %}

{% trans "Upload file" %}

- +
@@ -42,7 +42,7 @@ {% trans "This payment source will be used to create any payments for new members that already exist in the database." %} - +
diff --git a/members/templates/member_list.html b/members/templates/member_list.html index 6952362..f293064 100644 --- a/members/templates/member_list.html +++ b/members/templates/member_list.html @@ -41,7 +41,7 @@ {{ table|safe }}
{% endblock content %} diff --git a/members/templates/payment_list.html b/members/templates/payment_list.html index c7afbda..0329cd7 100644 --- a/members/templates/payment_list.html +++ b/members/templates/payment_list.html @@ -38,7 +38,7 @@ {{ table|safe }}
{% endblock content %} diff --git a/members/templates/upload_form.html b/members/templates/upload_form.html index 23ed103..8163128 100644 --- a/members/templates/upload_form.html +++ b/members/templates/upload_form.html @@ -5,6 +5,6 @@

{{ header }}

{% csrf_token %} {{ form }} - + {% endblock %} \ No newline at end of file diff --git a/ohlhafv/templates/list.html b/ohlhafv/templates/list.html index 59ff237..df0d75d 100644 --- a/ohlhafv/templates/list.html +++ b/ohlhafv/templates/list.html @@ -14,7 +14,7 @@ {% for challenge in challenges %}
-

{{ challenge.challenger }} vs. {{ challenge.victim }}

+

{{ challenge.challenger }} vs. {{ challenge.victim }}

{{ challenge.get_series_display }}

{{ challenge.message|linebreaks|urlize }}

diff --git a/poetry.lock b/poetry.lock index a1eeacd..f5e3067 100644 --- a/poetry.lock +++ b/poetry.lock @@ -53,6 +53,14 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "cfgv" +version = "3.3.1" +description = "Validate configuration and produce human readable error messages." +category = "main" +optional = false +python-versions = ">=3.6.1" + [[package]] name = "charset-normalizer" version = "2.0.12" @@ -110,6 +118,14 @@ category = "main" optional = false python-versions = ">=2.7" +[[package]] +name = "distlib" +version = "0.3.4" +description = "Distribution utilities" +category = "main" +optional = false +python-versions = "*" + [[package]] name = "django" version = "2.2.28" @@ -346,6 +362,18 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "filelock" +version = "3.7.1" +description = "A platform independent file lock." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"] +testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"] + [[package]] name = "gunicorn" version = "20.1.0" @@ -360,6 +388,17 @@ gevent = ["gevent (>=1.4.0)"] setproctitle = ["setproctitle"] tornado = ["tornado (>=0.2)"] +[[package]] +name = "identify" +version = "2.5.1" +description = "File identification library for Python" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.3" @@ -439,6 +478,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "nodeenv" +version = "1.7.0" +description = "Node.js virtual environment builder" +category = "main" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" + [[package]] name = "nose" version = "1.3.7" @@ -513,7 +560,7 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa name = "platformdirs" version = "2.5.2" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" +category = "main" optional = false python-versions = ">=3.7" @@ -521,6 +568,22 @@ python-versions = ">=3.7" docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"] test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"] +[[package]] +name = "pre-commit" +version = "2.19.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +toml = "*" +virtualenv = ">=20.0.8" + [[package]] name = "psycopg2-binary" version = "2.8.6" @@ -650,7 +713,7 @@ python-versions = "*" name = "pyyaml" version = "6.0" description = "YAML parser and emitter for Python" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -782,7 +845,7 @@ python-versions = "*" name = "toml" version = "0.10.2" description = "Python Library for Tom's Obvious, Minimal Language" -category = "dev" +category = "main" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" @@ -823,6 +886,24 @@ category = "main" optional = false python-versions = "*" +[[package]] +name = "virtualenv" +version = "20.15.1" +description = "Virtual Python Environment builder" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[package.dependencies] +distlib = ">=0.3.1,<1" +filelock = ">=3.2,<4" +platformdirs = ">=2,<3" +six = ">=1.9.0,<2" + +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)"] + [[package]] name = "whitenoise" version = "4.1.4" @@ -849,7 +930,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "7bd8922d622b0f6a042c5508bb2789bb3fb69df3b3198ae0adca52ce12432887" +content-hash = "6ec0f461a5cc62edfc77f1b4e4f1b79647a86d9193d6492574ef6a44e15cc89b" [metadata.files] attrs = [ @@ -889,6 +970,10 @@ certifi = [ {file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"}, {file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"}, ] +cfgv = [ + {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, + {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, +] charset-normalizer = [ {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, @@ -963,6 +1048,10 @@ diff-match-patch = [ {file = "diff-match-patch-20200713.tar.gz", hash = "sha256:da6f5a01aa586df23dfc89f3827e1cafbb5420be9d87769eeb079ddfd9477a18"}, {file = "diff_match_patch-20200713-py3-none-any.whl", hash = "sha256:8bf9d9c4e059d917b5c6312bac0c137971a32815ddbda9c682b949f2986b4d34"}, ] +distlib = [ + {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, + {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, +] django = [ {file = "Django-2.2.28-py3-none-any.whl", hash = "sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45"}, {file = "Django-2.2.28.tar.gz", hash = "sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413"}, @@ -1034,10 +1123,18 @@ et-xmlfile = [ {file = "et_xmlfile-1.1.0-py3-none-any.whl", hash = "sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada"}, {file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"}, ] +filelock = [ + {file = "filelock-3.7.1-py3-none-any.whl", hash = "sha256:37def7b658813cda163b56fc564cdc75e86d338246458c4c28ae84cabefa2404"}, + {file = "filelock-3.7.1.tar.gz", hash = "sha256:3a0fd85166ad9dbab54c9aec96737b744106dc5f15c0b09a6744a445299fcf04"}, +] gunicorn = [ {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, ] +identify = [ + {file = "identify-2.5.1-py2.py3-none-any.whl", hash = "sha256:0dca2ea3e4381c435ef9c33ba100a78a9b40c0bab11189c7cf121f75815efeaa"}, + {file = "identify-2.5.1.tar.gz", hash = "sha256:3d11b16f3fe19f52039fb7e39c9c884b21cb1b586988114fbe42671f03de3e82"}, +] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, @@ -1066,6 +1163,10 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] +nodeenv = [ + {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, + {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, +] nose = [ {file = "nose-1.3.7-py2-none-any.whl", hash = "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a"}, {file = "nose-1.3.7-py3-none-any.whl", hash = "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac"}, @@ -1133,6 +1234,10 @@ platformdirs = [ {file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"}, {file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"}, ] +pre-commit = [ + {file = "pre_commit-2.19.0-py2.py3-none-any.whl", hash = "sha256:10c62741aa5704faea2ad69cb550ca78082efe5697d6f04e5710c3c229afdd10"}, + {file = "pre_commit-2.19.0.tar.gz", hash = "sha256:4233a1e38621c87d9dda9808c6606d7e7ba0e087cd56d3fe03202a01d2919615"}, +] psycopg2-binary = [ {file = "psycopg2-binary-2.8.6.tar.gz", hash = "sha256:11b9c0ebce097180129e422379b824ae21c8f2a6596b159c7659e2e5a00e1aa0"}, {file = "psycopg2_binary-2.8.6-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:d14b140a4439d816e3b1229a4a525df917d6ea22a0771a2a78332273fd9528a4"}, @@ -1319,6 +1424,10 @@ urllib3 = [ uwsgi = [ {file = "uwsgi-2.0.20.tar.gz", hash = "sha256:88ab9867d8973d8ae84719cf233b7dafc54326fcaec89683c3f9f77c002cdff9"}, ] +virtualenv = [ + {file = "virtualenv-20.15.1-py2.py3-none-any.whl", hash = "sha256:b30aefac647e86af6d82bfc944c556f8f1a9c90427b2fb4e3bfbf338cb82becf"}, + {file = "virtualenv-20.15.1.tar.gz", hash = "sha256:288171134a2ff3bfb1a2f54f119e77cd1b81c29fc1265a2356f3e8d14c7d58c4"}, +] whitenoise = [ {file = "whitenoise-4.1.4-py2.py3-none-any.whl", hash = "sha256:6dfea214b7c12efd689007abf9afa87a426586e9dbc051873ad2c8e535e2a1ac"}, {file = "whitenoise-4.1.4.tar.gz", hash = "sha256:22f79cf8f1f509639330f93886acaece8ec5ac5e9600c3b981d33c34e8a42dfd"}, diff --git a/pyproject.toml b/pyproject.toml index 7fc3cd6..83ef4ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ sentry-sdk = "^1.4.3" django-polymorphic = "^3.1.0" python-dotenv = "^0.20.0" djangorestframework-simplejwt = "^5.2.0" +pre-commit = "^2.19.0" [tool.poetry.dev-dependencies] coverage = "^5.5" diff --git a/scripts/db/init.sql b/scripts/db/init.sql index 174e287..ad748e2 100644 --- a/scripts/db/init.sql +++ b/scripts/db/init.sql @@ -3,8 +3,8 @@ CREATE USER sik WITH PASSWORD 'password123'; ALTER ROLE sik SET client_encoding TO 'utf8'; ALTER ROLE sik SET default_transaction_isolation TO 'read committed'; ALTER ROLE sik SET timezone TO 'UTC'; -CREATE DATABASE sik - ENCODING 'UTF8' +CREATE DATABASE sik + ENCODING 'UTF8' OWNER sik; GRANT ALL PRIVILEGES ON DATABASE sik TO sik; ALTER USER sik CREATEDB; diff --git a/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js b/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js index 5caa110..2aa8c0e 100644 --- a/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js +++ b/static/js/lib/ng-file-upload-bower-12.2.11/FileAPI.js @@ -3475,19 +3475,19 @@ } while( (node = node.parentNode) && (node !== document.body) ); }, - + disableMouseover: false, mouseover: function (evt){ if (!flash.disableMouseover) { var target = api.event.fix(evt).target; - + if( /input/i.test(target.nodeName) && target.type == 'file' && !target.disabled ){ var state = target.getAttribute(_attr) , wrapper = flash.getWrapper(target) ; - + if( api.multiFlash ){ // check state: // i — published @@ -3500,14 +3500,14 @@ else if( state != 'p' ){ // set "init" state target.setAttribute(_attr, 'i'); - + var dummy = document.createElement('div'); - + if( !wrapper ){ api.log('[err] FlashAPI.mouseover: js-fileapi-wrapper not found'); return; } - + _css(dummy, { top: 0 , left: 0 @@ -3516,21 +3516,21 @@ , zIndex: 1e6+'' // set max zIndex , position: 'absolute' }); - + wrapper.appendChild(dummy); flash.publish(dummy, api.uid()); - + // set "publish" state target.setAttribute(_attr, 'p'); } - + return true; } else if( wrapper ){ // Use one flash element var box = _getDimensions(wrapper); _css(flash.getEl(), box); - + // Set current input flash.curInp = target; } @@ -3543,7 +3543,7 @@ onEvent: function (evt){ var type = evt.type; - + if( type == 'ready' ){ try { // set "ready" state @@ -3632,9 +3632,9 @@ _each(files, function (file){ api.checkFileObj(file); }); - + _files[uid] = files; - + if( document.createEvent ){ event = document.createEvent('Event'); event.files = files; @@ -3664,7 +3664,7 @@ this.cmdFn(id, name, data, last); } }, - + cmdFn: function(id, name, data, last) { try { api.log('(js -> flash).'+name+':', data); @@ -3727,7 +3727,7 @@ callback(evt); }); }, - + getFiles: function (input, filter, callback){ if( callback ){ api.filterFiles(api.getFiles(input), filter, callback); @@ -4039,7 +4039,7 @@ } try { el.style[key] = val; } catch (e) {} } - + } } @@ -4161,7 +4161,7 @@ , body = document.body , docEl = (el && el.ownerDocument).documentElement ; - + function getOffset(obj) { var left, top; left = top = 0; @@ -4176,7 +4176,7 @@ top : top }; }; - + return { top: getOffset(el).top , left: getOffset(el).left diff --git a/webapp/templates/contact.html b/webapp/templates/contact.html index f0d6707..e24dd70 100644 --- a/webapp/templates/contact.html +++ b/webapp/templates/contact.html @@ -7,7 +7,7 @@ {% load static %}

{% trans "Contact" %}

- + {% if committees %} {% for committee in committees %} @@ -23,7 +23,7 @@
{{role.name}}
-

{{official.first_name}} +

{{official.first_name}} {{official.last_name}} {{official.email}}