add dpp
This commit is contained in:
parent
312f8a01bf
commit
49d19ec38e
|
@ -62,7 +62,7 @@ class DidView(View):
|
||||||
if rols:
|
if rols:
|
||||||
self.context['rols'] = rols
|
self.context['rols'] = rols
|
||||||
|
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if not session.get('token_dlt'):
|
if not session.get('token_dlt'):
|
||||||
|
|
|
@ -69,7 +69,7 @@ class LoginForm(FlaskForm):
|
||||||
if not user.is_active:
|
if not user.is_active:
|
||||||
self.form_errors.append(self.error_messages['inactive'])
|
self.form_errors.append(self.error_messages['inactive'])
|
||||||
|
|
||||||
if 'trublo' in app.blueprints.keys():
|
if 'dpp' in app.blueprints.keys():
|
||||||
token_dlt = (
|
token_dlt = (
|
||||||
user.get_dlt_keys(self.password.data).get('data', {}).get('api_token')
|
user.get_dlt_keys(self.password.data).get('data', {}).get('api_token')
|
||||||
)
|
)
|
||||||
|
@ -111,7 +111,7 @@ class PasswordForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
keys_dlt = g.user.get_dlt_keys(self.password.data)
|
keys_dlt = g.user.get_dlt_keys(self.password.data)
|
||||||
g.user.reset_dlt_keys(self.newpassword.data, keys_dlt)
|
g.user.reset_dlt_keys(self.newpassword.data, keys_dlt)
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
def register_proof(self):
|
def register_proof(self):
|
||||||
"""This method is used for register a proof of erasure en dlt"""
|
"""This method is used for register a proof of erasure en dlt"""
|
||||||
|
|
||||||
if 'trublo' not in app.blueprints.keys() or not self.snapshot:
|
if 'dpp' not in app.blueprints.keys() or not self.snapshot:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not session.get('token_dlt'):
|
if not session.get('token_dlt'):
|
||||||
|
@ -875,7 +875,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
return snapshots and 'update' or 'new_device'
|
return snapshots and 'update' or 'new_device'
|
||||||
|
|
||||||
def register_passport_dlt(self):
|
def register_passport_dlt(self):
|
||||||
if 'trublo' not in app.blueprints.keys() or not self.device.hid:
|
if 'dpp' not in app.blueprints.keys() or not self.device.hid:
|
||||||
return
|
return
|
||||||
|
|
||||||
from ereuse_devicehub.resources.did.models import Dpp
|
from ereuse_devicehub.resources.did.models import Dpp
|
||||||
|
|
|
@ -934,7 +934,7 @@ class Device(Thing):
|
||||||
return types.get(self.type, '')
|
return types.get(self.type, '')
|
||||||
|
|
||||||
def register_dlt(self):
|
def register_dlt(self):
|
||||||
if 'trublo' not in app.blueprints.keys() or not self.hid:
|
if 'dpp' not in app.blueprints.keys() or not self.hid:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not session.get('token_dlt'):
|
if not session.get('token_dlt'):
|
||||||
|
|
|
@ -141,7 +141,7 @@ class DeviceView(View):
|
||||||
if rols:
|
if rols:
|
||||||
return [(k, k) for k in rols]
|
return [(k, k) for k in rols]
|
||||||
|
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if not session.get('token_dlt'):
|
if not session.get('token_dlt'):
|
||||||
|
|
|
@ -102,12 +102,12 @@ class User(UserMixin, Thing):
|
||||||
return self.password == password
|
return self.password == password
|
||||||
|
|
||||||
def set_new_dlt_keys(self, password):
|
def set_new_dlt_keys(self, password):
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return
|
return
|
||||||
|
|
||||||
from ereuseapi.methods import register_user
|
from ereuseapi.methods import register_user
|
||||||
|
|
||||||
from ereuse_devicehub.modules.trublo.utils import encrypt
|
from ereuse_devicehub.modules.dpp.utils import encrypt
|
||||||
|
|
||||||
api_dlt = app.config.get('API_DLT')
|
api_dlt = app.config.get('API_DLT')
|
||||||
data = register_user(api_dlt)
|
data = register_user(api_dlt)
|
||||||
|
@ -117,10 +117,10 @@ class User(UserMixin, Thing):
|
||||||
return api_token
|
return api_token
|
||||||
|
|
||||||
def get_dlt_keys(self, password):
|
def get_dlt_keys(self, password):
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
from ereuse_devicehub.modules.trublo.utils import decrypt
|
from ereuse_devicehub.modules.dpp.utils import decrypt
|
||||||
|
|
||||||
if not self.api_keys_dlt:
|
if not self.api_keys_dlt:
|
||||||
return {}
|
return {}
|
||||||
|
@ -129,16 +129,16 @@ class User(UserMixin, Thing):
|
||||||
return json.loads(data)
|
return json.loads(data)
|
||||||
|
|
||||||
def reset_dlt_keys(self, password, data):
|
def reset_dlt_keys(self, password, data):
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return
|
return
|
||||||
|
|
||||||
from ereuse_devicehub.modules.trublo.utils import encrypt
|
from ereuse_devicehub.modules.dpp.utils import encrypt
|
||||||
|
|
||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
self.api_keys_dlt = encrypt(password, data)
|
self.api_keys_dlt = encrypt(password, data)
|
||||||
|
|
||||||
def allow_permitions(self, api_token=None):
|
def allow_permitions(self, api_token=None):
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return
|
return
|
||||||
|
|
||||||
if not api_token:
|
if not api_token:
|
||||||
|
@ -158,7 +158,7 @@ class User(UserMixin, Thing):
|
||||||
if session.get('rols'):
|
if session.get('rols'):
|
||||||
return session.get('rols')
|
return session.get('rols')
|
||||||
|
|
||||||
if 'trublo' not in app.blueprints.keys():
|
if 'dpp' not in app.blueprints.keys():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if not session.get('token_dlt'):
|
if not session.get('token_dlt'):
|
||||||
|
|
Reference in New Issue