From d218df4ddc3a4f850ae7ebd77015fe60ebe8c0e1 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 22 Feb 2024 13:50:07 +0100 Subject: [PATCH] add did for new user from import excel --- idhub/admin/forms.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/idhub/admin/forms.py b/idhub/admin/forms.py index 5db83bd..29ce073 100644 --- a/idhub/admin/forms.py +++ b/idhub/admin/forms.py @@ -257,18 +257,21 @@ class ImportForm(forms.Form): except jsonschema.exceptions.ValidationError as err: msg = "line {}: {}".format(line+1, err) return self.exception(msg) - # try: - # check = credtools.validate_json(row, self.json_schema) - # if check is not True: - # raise ValidationError("Not valid row") - # except Exception as e: user, new = User.objects.get_or_create(email=row.get('email')) if new: self.users.append(user) + user.set_encrypted_sensitive_data() + user.save() + self.create_defaults_dids(user) return user + def create_defaults_dids(self, user): + did = DID(label="Default", user=user, type=DID.Types.WEB) + did.set_did() + did.save() + def create_credential(self, user, row): bcred = VerificableCredential.objects.filter( user=user,