A Django middleware for verifying the user's age before allowing them access to resources
Project description
Important. This project has not been finished. It does not have the intended integration with https://github.com/zk-passport/openpassport/tree/main/sdk due to some errors encountered when creating the browser bundle of the said sdk.
A Django middleware for verifying the user's age before allowing them access to a resource. Developed for the purposes of the PSE Hackathon held in Sep 2024.
The user is expected to own an Android or iOS device with an NFC reader and a compatible passport.
Installation
- pip install age_verification_psehack
In your Django project's settings.py:
Add the following line to the bottom of the MIDDLEWARE section:
- "age_verification_psehack.middleware.AgeVerificationMiddleware"
Add the following line to the bottom of the INSTALLED_APPS section:
- "age_verification_psehack.apps.AgeVerificationPSEHackConfig"
Add a new AGE_VERIFICATION_PATHS setting containing all paths requiring age verification:
- AGE_VERIFICATION_PATHS = ['/protected_path1', '/protected/path2']
Usually all Django projects are already configured to serve static files. If yours is not configured, consult https://docs.djangoproject.com/en/4.2/howto/static-files/
Navigate to the root of your Django project and run:
- python manage.py makemigrations age_verification_psehack
- python manage.py migrate
- python manage.py collectstatic
For developers only: testing local changes
In case if you need to make changes and test them, in the root of this repo run
- python -m pip install build
- python -m build
In the root of your Django project create a file requirements.txt with the following:
-e path/to/the/root/of/this/repo
Then run:
python -m pip install -r requirements.txt
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for age_verification_psehack-0.2.2.tar.gz
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | d5e3ed0dbc5720c72bae280d1ca44f1e44389e0b608341604ae4fc5c20786adf |
|
| MD5 | 94a25247f1602a34e08ca6b5983a1a6d |
|
| BLAKE2b-256 | 9324acdac8175ffd12c9e2435638298986430f82015eed579c0719c860045c72 |
Hashes for age_verification_psehack-0.2.2-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 6e61f8142780a9a444f1bf99947cdf61ca05300b43d30cd4c882eca0df9cf8f9 |
|
| MD5 | 0c4fd7772bd5e6f1031cc3d2d6d7c92b |
|
| BLAKE2b-256 | 205561aba185fc2a45f0482b7575b389e6e9a535f7b0d3717d8f70066b1ae31a |