add code of oidc4vp in dashboard

This commit is contained in:
Cayo Puigdefabregas 2024-02-27 19:33:40 +01:00
parent 7fdf0dfe0b
commit d9ccc8bbb3
3 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,7 @@ class Event(models.Model):
EV_USR_DEACTIVATED_BY_ADMIN = 30, "User deactivated"
EV_USR_ACTIVATED_BY_ADMIN = 31, "User activated"
EV_USR_SEND_VP = 32, "User send Verificable Presentation"
EV_USR_SEND_CREDENTIAL = 33, "User send credential"
created = models.DateTimeField(_("Date"), auto_now=True)
message = models.CharField(_("Description"), max_length=350)
@ -417,6 +418,13 @@ class Event(models.Model):
user=user
)
@classmethod
def set_EV_USR_SEND_CREDENTIAL(cls, msg):
cls.objects.create(
type=cls.Types.EV_USR_SEND_CREDENTIAL,
message=msg,
)
class DID(models.Model):
class Types(models.IntegerChoices):

View File

@ -80,6 +80,7 @@ class DashboardView(UserView, SingleTableView):
Event.Types.EV_CREDENTIAL_PRESENTED, # Credential presented
Event.Types.EV_CREDENTIAL_CAN_BE_REQUESTED, # Credential available
Event.Types.EV_CREDENTIAL_REVOKED, # Credential revoked
Event.Types.EV_USR_SEND_VP, # User send verificable presentation
]
return events_for_users

View File

@ -79,6 +79,7 @@ class AuthorizeView(UserView, FormView):
elif authorization.get('response'):
txt = authorization.get('response')
messages.success(self.request, txt)
Event.set_EV_USR_SEND_CREDENTIAL(txt)
txt2 = f"Verifier {verifier} send: " + txt
Event.set_EV_USR_SEND_VP(txt2, self.request.user)
url = reverse_lazy('idhub:user_dashboard')