Merge branch 'release'
This commit is contained in:
commit
c204250397
|
@ -0,0 +1,2 @@
|
||||||
|
"localhost idhub1";"http://localhost/oidc4vp/";"localhost"
|
||||||
|
"localhost idhub2";"http://idhub2/oidc4vp/";"idhub2"
|
|
|
@ -217,13 +217,13 @@ class ImportForm(forms.Form):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def clean_file_import(self):
|
def clean_file_import(self):
|
||||||
props = self.json_schema.get("properties", {})
|
|
||||||
data = self.cleaned_data["file_import"]
|
data = self.cleaned_data["file_import"]
|
||||||
self.file_name = data.name
|
|
||||||
|
|
||||||
if not self._schema:
|
if not self._schema:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
self.file_name = data.name
|
||||||
|
props = self.json_schema.get("properties", {})
|
||||||
|
|
||||||
# Forze than pandas read one column as string
|
# Forze than pandas read one column as string
|
||||||
dtype_dict = {"phoneNumber": str}
|
dtype_dict = {"phoneNumber": str}
|
||||||
df = pd.read_excel(data, dtype=dtype_dict)
|
df = pd.read_excel(data, dtype=dtype_dict)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-end">
|
<div class="col text-end">
|
||||||
{% if object.get_status == 'Issued' %}
|
{% if object.get_status == 'Issued' %}
|
||||||
|
<a class="btn btn-green-admin me-2" href="{% url 'idhub:admin_credential_json' object.id %}">{% trans 'Download as JSON' %}</a>
|
||||||
<a class="btn btn-yellow" class="btn btn-orange" data-bs-toggle="modal" data-bs-target="#confirm-revoke" href="javascript:void()">{% trans 'Revoke' %}</a>
|
<a class="btn btn-yellow" class="btn btn-orange" data-bs-toggle="modal" data-bs-target="#confirm-revoke" href="javascript:void()">{% trans 'Revoke' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if object.get_status == 'Enabled' %}
|
{% if object.get_status == 'Enabled' %}
|
||||||
|
@ -48,13 +49,6 @@
|
||||||
{{ object.get_status}}
|
{{ object.get_status}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if object.issued_on %}
|
|
||||||
<div class="row mt-3">
|
|
||||||
<div class="col text-center">
|
|
||||||
<a class="btn btn-green-admin" href="{% url 'idhub:admin_credential_json' object.id %}">{% trans 'Download in JSON format' %}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Modal Revoke -->
|
<!-- Modal Revoke -->
|
||||||
|
|
|
@ -2,10 +2,29 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h3>
|
||||||
<i class="{{ icon }}"></i>
|
<i class="{{ icon }}"></i>
|
||||||
{{ subtitle }}
|
{{ subtitle }}
|
||||||
</h3>
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col text-end">
|
||||||
|
{% if object.get_status == 'Issued' %}
|
||||||
|
<div class="col">
|
||||||
|
{% if object.eidas1_did and admin_validated %}
|
||||||
|
<a class="btn btn-green-user me-2" href="{% url 'idhub:user_credential_pdf' object.id %}">{% trans 'Download as PDF' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
<a class="btn btn-green-user" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Download as JSON' %}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if object.get_status == 'Enabled' %}
|
||||||
|
<div class="col">
|
||||||
|
<a class="btn btn-green-user" href="{% url 'idhub:user_credentials_request' %}">{% trans 'Request credential' %}</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,21 +57,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if object.get_status == 'Issued' %}
|
|
||||||
<div class="row mt-3">
|
|
||||||
{% if object.eidas1_did and admin_validated %}
|
|
||||||
<div class="col text-center">
|
|
||||||
<a class="btn btn-green-user" href="{% url 'idhub:user_credential_pdf' object.id %}">{% trans 'Sign credential in PDF format' %}</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="col text-center">
|
|
||||||
<a class="btn btn-green-user" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Download credential in JSON format' %}</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if object.get_status == 'Enabled' %}
|
|
||||||
<div class="col text-center">
|
|
||||||
<a class="btn btn-green-user" href="{% url 'idhub:user_credentials_request' %}">{% trans 'Request credential' %}</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if form.if_credentials %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_form form %}
|
{% bootstrap_form form %}
|
||||||
|
@ -29,6 +30,13 @@
|
||||||
<a class="btn btn-grey" href="{% url 'idhub:user_credentials' %}">{% trans "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'idhub:user_credentials' %}">{% trans "Cancel" %}</a>
|
||||||
<input class="btn btn-green-user" type="submit" name="submit" value="{% trans 'Send' %}" />
|
<input class="btn btn-green-user" type="submit" name="submit" value="{% trans 'Send' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
{% trans 'Sorry no there are credentials to present' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if form.if_credentials %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_form form %}
|
{% bootstrap_form form %}
|
||||||
|
@ -29,6 +30,12 @@
|
||||||
<a class="btn btn-grey" href="{% url 'idhub:user_credentials' %}">{% trans "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'idhub:user_credentials' %}">{% trans "Cancel" %}</a>
|
||||||
<input class="btn btn-green-user" type="submit" name="submit" value="{% trans 'Request' %}" />
|
<input class="btn btn-green-user" type="submit" name="submit" value="{% trans 'Request' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
{% trans 'Sorry no there are credentials enabled' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -86,6 +86,7 @@ class RequestCredentialForm(forms.Form):
|
||||||
self.user = kwargs.pop('user', None)
|
self.user = kwargs.pop('user', None)
|
||||||
self.lang = kwargs.pop('lang', None)
|
self.lang = kwargs.pop('lang', None)
|
||||||
self._domain = kwargs.pop('domain', None)
|
self._domain = kwargs.pop('domain', None)
|
||||||
|
self.if_credentials = kwargs.pop('if_credentials', None)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['did'].choices = [
|
self.fields['did'].choices = [
|
||||||
(x.did, x.label) for x in DID.objects.filter(user=self.user)
|
(x.did, x.label) for x in DID.objects.filter(user=self.user)
|
||||||
|
@ -130,6 +131,7 @@ class DemandAuthorizationForm(forms.Form):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.user = kwargs.pop('user', None)
|
self.user = kwargs.pop('user', None)
|
||||||
|
self.if_credentials = kwargs.pop('if_credentials', None)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['organization'].choices = [
|
self.fields['organization'].choices = [
|
||||||
(x.id, x.name) for x in Organization.objects.exclude(
|
(x.id, x.name) for x in Organization.objects.exclude(
|
||||||
|
|
|
@ -392,18 +392,26 @@ class CredentialsRequestView(MyWallet, FormView):
|
||||||
form_class = RequestCredentialForm
|
form_class = RequestCredentialForm
|
||||||
success_url = reverse_lazy('idhub:user_credentials')
|
success_url = reverse_lazy('idhub:user_credentials')
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
response = super().get(request, *args, **kwargs)
|
response = super().get(*args, **kwargs)
|
||||||
if not cache.get("KEY_DIDS"):
|
if not DID.objects.filter(user=self.request.user).exists():
|
||||||
return redirect(reverse_lazy('idhub:user_waiting'))
|
return redirect(reverse_lazy('idhub:user_dids_new'))
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
kwargs = super().get_form_kwargs()
|
kwargs = super().get_form_kwargs()
|
||||||
|
self.if_credentials = VerificableCredential.objects.filter(
|
||||||
|
user=self.request.user,
|
||||||
|
status=VerificableCredential.Status.ENABLED.value,
|
||||||
|
).exists()
|
||||||
|
|
||||||
kwargs['user'] = self.request.user
|
kwargs['user'] = self.request.user
|
||||||
kwargs['lang'] = self.request.LANGUAGE_CODE
|
kwargs['lang'] = self.request.LANGUAGE_CODE
|
||||||
domain = "{}://{}".format(self.request.scheme, self.request.get_host())
|
domain = "{}://{}".format(self.request.scheme, self.request.get_host())
|
||||||
kwargs['domain'] = domain
|
kwargs['domain'] = domain
|
||||||
|
kwargs['if_credentials'] = self.if_credentials
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
@ -427,9 +435,26 @@ class DemandAuthorizationView(MyWallet, FormView):
|
||||||
form_class = DemandAuthorizationForm
|
form_class = DemandAuthorizationForm
|
||||||
success_url = reverse_lazy('idhub:user_demand_authorization')
|
success_url = reverse_lazy('idhub:user_demand_authorization')
|
||||||
|
|
||||||
|
def get(self, *args, **kwargs):
|
||||||
|
response = super().get(*args, **kwargs)
|
||||||
|
creds_enable = VerificableCredential.objects.filter(
|
||||||
|
user=self.request.user,
|
||||||
|
status=VerificableCredential.Status.ENABLED.value,
|
||||||
|
).exists()
|
||||||
|
|
||||||
|
if not self.if_credentials and creds_enable:
|
||||||
|
return redirect(reverse_lazy('idhub:user_credentials_request'))
|
||||||
|
return response
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
kwargs = super().get_form_kwargs()
|
kwargs = super().get_form_kwargs()
|
||||||
|
self.if_credentials = VerificableCredential.objects.filter(
|
||||||
|
user=self.request.user,
|
||||||
|
status=VerificableCredential.Status.ISSUED.value,
|
||||||
|
).exists()
|
||||||
|
|
||||||
kwargs['user'] = self.request.user
|
kwargs['user'] = self.request.user
|
||||||
|
kwargs['if_credentials'] = self.if_credentials
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|
|
@ -286,10 +286,10 @@ class OAuth2VPToken(models.Model):
|
||||||
}
|
}
|
||||||
verification = json.loads(self.result_verify)
|
verification = json.loads(self.result_verify)
|
||||||
if verification.get('errors') or verification.get('warnings'):
|
if verification.get('errors') or verification.get('warnings'):
|
||||||
response["verify"] = "Error, Verification Failed"
|
response["verify"] = "Error, {}".format(_("Failed verification"))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
response["verify"] = "Ok, Verification correct"
|
response["verify"] = "Ok, {}".format(_("Correct verification"))
|
||||||
url = self.get_redirect_url()
|
url = self.get_redirect_url()
|
||||||
if url:
|
if url:
|
||||||
response["redirect_uri"] = url
|
response["redirect_uri"] = url
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Hola, hay una nueva verificación en el servicio de verificación Idhub {{ domain }}
|
||||||
|
<br />
|
||||||
|
El código asociado a esta verificación es: {{ code }}
|
||||||
|
<br />
|
||||||
|
estos son los datos de la verificación:
|
||||||
|
<br />
|
||||||
|
{{ verification|safe }}
|
||||||
|
|
||||||
|
<br />
|
||||||
|
Muchas gracias
|
|
@ -0,0 +1,6 @@
|
||||||
|
Hola, hay una nueva verificación en el servicio de verificación Idhub {{ domain }}
|
||||||
|
El código asociado a esta verificación es: {{ code }}
|
||||||
|
estos son los datos de la verificación:
|
||||||
|
{{ verification|safe }}
|
||||||
|
|
||||||
|
Muchas gracias
|
|
@ -0,0 +1 @@
|
||||||
|
Nueva verificacion en {{ dominio }}
|
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
{% load i18n static %}
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="robots" content="NONE,NOARCHIVE" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="Pangea">
|
||||||
|
<title>{% block title %}{% if title %}{{ title }} – {% endif %}Pangea{% endblock %}</title>
|
||||||
|
|
||||||
|
<!-- Bootstrap core CSS -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||||
|
<link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
||||||
|
<link href="{% static "/css/bootstrap.min.css" %}" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.bd-placeholder-img {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
text-anchor: middle;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.bd-placeholder-img-lg {
|
||||||
|
font-size: 3.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Custom styles for this template -->
|
||||||
|
<link href="{% static "/css/dashboard.css" %}" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body id="body-login">
|
||||||
|
<header class="navbar navbar-dark sticky-top bg-grey flex-md-nowrap p-0 shadow" style="background-color: #712547;">
|
||||||
|
<div class="navbar-nav navbar-sub-brand">
|
||||||
|
</div>
|
||||||
|
<div class="navbar-nav">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<main class="col-md-12 bt-5">
|
||||||
|
|
||||||
|
<div class="jumbotron vertical-center">
|
||||||
|
<div id="login-wrapper" class="container" style="width: 430px;">
|
||||||
|
<div id="login-content" class="rounded">
|
||||||
|
<div id="login-branding">
|
||||||
|
</div><!-- /login-branding -->
|
||||||
|
<div class="mt-5">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{% trans 'Thank you, we are received your presentation correctly.' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.row-fluid -->
|
||||||
|
</div>
|
||||||
|
<!--/#login-content-->
|
||||||
|
</div><!-- /#login-wrapper -->
|
||||||
|
</div><!-- /.jumbotron -->
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -13,4 +13,6 @@ urlpatterns = [
|
||||||
name="authorize"),
|
name="authorize"),
|
||||||
path('allow_code', views.AllowCodeView.as_view(),
|
path('allow_code', views.AllowCodeView.as_view(),
|
||||||
name="allow_code"),
|
name="allow_code"),
|
||||||
|
path('received_code', views.ReceivedCodeView.as_view(),
|
||||||
|
name="received_code"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -235,7 +235,17 @@ class AllowCodeView(View):
|
||||||
|
|
||||||
promotion = self.authorization.promotions.first()
|
promotion = self.authorization.promotions.first()
|
||||||
if not promotion:
|
if not promotion:
|
||||||
raise Http404("Page not Found!")
|
return redirect(reverse_lazy('oidc4vp:received_code'))
|
||||||
|
|
||||||
return redirect(promotion.get_url(code))
|
return redirect(promotion.get_url(code))
|
||||||
|
|
||||||
|
|
||||||
|
class ReceivedCodeView(View):
|
||||||
|
template_name = "received_code.html"
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
self.context = {}
|
||||||
|
template = loader.get_template(
|
||||||
|
self.template_name,
|
||||||
|
).render()
|
||||||
|
return HttpResponse(template)
|
||||||
|
|
Loading…
Reference in New Issue