From 57efe853e0da5a36003f90ebc4032a5018f44608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Mon, 6 Jan 2020 12:23:41 +0000 Subject: [PATCH] added djcl namespace to all settings related to this project --- HISTORY.rst | 1 + README.rst | 16 +++++++++++----- django_cryptolock/utils.py | 8 ++++---- example/example/settings.py | 8 ++++---- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index b6b431a..caaada2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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) ++++++++++++++++++ diff --git a/README.rst b/README.rst index 50a2776..e102c8b 100644 --- a/README.rst +++ b/README.rst @@ -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 ------------- diff --git a/django_cryptolock/utils.py b/django_cryptolock/utils.py index 7a6ee01..47eb11b 100644 --- a/django_cryptolock/utils.py +++ b/django_cryptolock/utils.py @@ -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( diff --git a/example/example/settings.py b/example/example/settings.py index e12f31e..837c2be 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -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")