From 25482125a3978a0c8ff0c72b17e10b093fe498f9 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 5 Jul 2021 15:04:14 +0200 Subject: [PATCH] pass into .env --- ereuse_devicehub/config.py | 1 + ereuse_devicehub/resources/action/views/views.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 9f05c29d..01a98292 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -76,3 +76,4 @@ class DevicehubConfig(Config): """Definition of path where save the documents of customers""" PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/') + JWT_PASS = config('JWT_PASS', '') diff --git a/ereuse_devicehub/resources/action/views/views.py b/ereuse_devicehub/resources/action/views/views.py index 2fd8d04d..634294f5 100644 --- a/ereuse_devicehub/resources/action/views/views.py +++ b/ereuse_devicehub/resources/action/views/views.py @@ -1,5 +1,7 @@ """ This is the view for Snapshots """ +import jwt +import ereuse_utils from datetime import timedelta from distutils.version import StrictVersion from uuid import UUID @@ -167,12 +169,9 @@ class LiveView(View): return live -import jwt -import ereuse_utils def decode_snapshot(data): - p = '7KU4ZzsEfe' try: - return jwt.decode(data['data'], p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) + return jwt.decode(data['data'], app.config['JWT_PASS'], algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) except jwt.exceptions.InvalidSignatureError as err: txt = 'Invalid snapshot' raise ValidationError(txt)