added djcl namespace to all settings related to this project

This commit is contained in:
Gonçalo Valério 2020-01-06 12:23:41 +00:00
parent 3de2feca1d
commit 57efe853e0
4 changed files with 20 additions and 13 deletions

View File

@ -10,6 +10,7 @@ History
* Default location for templates moved to ``django_cryptolock`` folder.
* Update quickstart guide.
* Update instructions to contribute to the project.
* Add ``DJCL`` namespace to all related settings.
0.0.1 (2019-11-25)
++++++++++++++++++

View File

@ -50,18 +50,24 @@ Add Django-Cryptolock's URL patterns:
...
]
Add the following settings to your project:
* ``django_cryptolock.backends.MoneroAddressBackend`` to your ``AUTHENTICATION_BACKENDS``
* Set ``DJCL_MONERO_NETWORK`` with the network in use: ``mainnet``, ``stagenet`` or ``testnet``
* Use ``MONERO_WALLET_RPC_PROTOCOL``, ``MONERO_WALLET_RPC_HOST``, ``MONERO_WALLET_RPC_USER`` and ``MONERO_WALLET_RPC_PASS`` to specify which wallet RPC should be used.
* ``django_cryptolock.backends.MoneroAddressBackend`` to your
``AUTHENTICATION_BACKENDS``
* Set ``DJCL_MONERO_NETWORK`` with the network in use: ``mainnet``,
``stagenet`` or ``testnet``
* Use ``DJCL_MONERO_WALLET_RPC_PROTOCOL``, ``DJCL_MONERO_WALLET_RPC_HOST``,
``DJCL_MONERO_WALLET_RPC_USER`` and ``DJCL_MONERO_WALLET_RPC_PASS`` to specify
which wallet RPC should be used.
Finaly create the templates files (``login.html`` and ``signup.html``) under a ``django_cryptolock`` subfolder.
Finaly create the templates files (``login.html`` and ``signup.html``) under a
``django_cryptolock`` subfolder.
Features
--------
* Adds authentication based on cryptocurrency wallets a Django project.
* Adds authentication based on cryptocurrency wallets to a Django project.
Running Tests
-------------

View File

@ -7,10 +7,10 @@ from monerorpc.authproxy import AuthServiceProxy
def verify_signature(address: str, challenge: str, signature: str) -> bool:
"""Makes a request to wallet RPC to verify address and signature."""
protocol = settings.MONERO_WALLET_RPC_PROTOCOL
host = settings.MONERO_WALLET_RPC_HOST
user = settings.MONERO_WALLET_RPC_USER
pwd = settings.MONERO_WALLET_RPC_PASS
protocol = settings.DJCL_MONERO_WALLET_RPC_PROTOCOL
host = settings.DJCL_MONERO_WALLET_RPC_HOST
user = settings.DJCL_MONERO_WALLET_RPC_USER
pwd = settings.DJCL_MONERO_WALLET_RPC_PASS
wallet_rpc = AuthServiceProxy(f"{protocol}://{user}:{pwd}@{host}/json_rpc")
result = wallet_rpc.verify(

View File

@ -121,7 +121,7 @@ LOGOUT_REDIRECT_URL = "/"
AUTHENTICATION_BACKENDS = ["django_cryptolock.backends.MoneroAddressBackend"]
DJCL_MONERO_NETWORK = "mainnet"
MONERO_WALLET_RPC_PROTOCOL = os.environ.get("MONERO_WALLET_RPC_PROTOCOL", "http")
MONERO_WALLET_RPC_HOST = os.environ.get("MONERO_WALLET_RPC_HOST", "localhost:6000")
MONERO_WALLET_RPC_USER = os.environ.get("MONERO_WALLET_RPC_USER")
MONERO_WALLET_RPC_PASS = os.environ.get("MONERO_WALLET_RPC_PASS")
DJCL_MONERO_WALLET_RPC_PROTOCOL = os.environ.get("MONERO_WALLET_RPC_PROTOCOL", "http")
DJCL_MONERO_WALLET_RPC_HOST = os.environ.get("MONERO_WALLET_RPC_HOST", "localhost:6000")
DJCL_MONERO_WALLET_RPC_USER = os.environ.get("MONERO_WALLET_RPC_USER")
DJCL_MONERO_WALLET_RPC_PASS = os.environ.get("MONERO_WALLET_RPC_PASS")