misc: import pre-commit configuration from authentic
gitea/authentic2-cut/pipeline/head This commit looks good
Details
gitea/authentic2-cut/pipeline/head This commit looks good
Details
This commit is contained in:
parent
62a963157b
commit
eac6a4be92
|
@ -5,21 +5,31 @@ repos:
|
|||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: double-quote-string-fixer
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py39-plus']
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.13.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: ['--target-version', '3.2']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
||||
args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '110']
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.20.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: '3.0.5'
|
||||
hooks:
|
||||
- id: djhtml
|
||||
args: ['--tabwidth', '2']
|
||||
- repo: https://git.entrouvert.org/pre-commit-debian.git
|
||||
rev: v0.3
|
||||
hooks:
|
||||
|
|
|
@ -14,5 +14,3 @@
|
|||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
default_app_config = 'authentic2_cut.apps.AppConfig'
|
||||
|
|
|
@ -50,7 +50,7 @@ A2_CUT_PARTNERS = [
|
|||
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
|
||||
|
||||
# 48h pour les mails de reset de mot de passe
|
||||
PASSWORD_RESET_TIMEOUT_DAYS = 2
|
||||
PASSWORD_RESET_TIMEOUT = 60 * 60 * 24 * 2
|
||||
A2_EMAIL_CHANGE_TOKEN_LIFETIME = 3600 * 24 * 2
|
||||
ACCOUNT_ACTIVATION_DAYS = 2
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ class Command(BaseCommand):
|
|||
with atomic():
|
||||
validation_request = ValidationRequest.objects.create(user=user, origin=oidc_client)
|
||||
for path in paths:
|
||||
|
||||
with open(path) as file_object:
|
||||
filename = os.path.basename(path)
|
||||
f = ContentFile(file_object.read(), name=filename)
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2_cut', '0001_initial'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2_cut', '0003_auto_20180423_1532'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2_cut', '0004_auto_20180801_1147'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2_cut', '0005_auto_20200515_1616'),
|
||||
]
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from . import models
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{% extends "emails/body_base.html" %}
|
||||
{% block content %}
|
||||
<p>Bonjour,</p>
|
||||
<p>Bonjour,</p>
|
||||
|
||||
<p>
|
||||
Un agent vient de modifier votre compte de la manière suivante :
|
||||
</p>
|
||||
<p>
|
||||
Un agent vient de modifier votre compte de la manière suivante :
|
||||
</p>
|
||||
|
||||
<ul><li>{{ message }}</li></ul>
|
||||
<ul><li>{{ message }}</li></ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<ul class="messages">
|
||||
<li class="info">
|
||||
<p>Vous devez demander à l'usager de présenter une pièce d'identité pour valider son compte ou
|
||||
modifier des données cœur déjà validées.</p>
|
||||
<p>Si l'usager est mineur, son identité ne peut pas être validée. Pour l'accès au service, merci de se référer au protocole d'accès du partenaire</p>
|
||||
</li>
|
||||
</ul>
|
||||
{{ block.super }}
|
||||
<ul class="messages">
|
||||
<li class="info">
|
||||
<p>Vous devez demander à l'usager de présenter une pièce d'identité pour valider son compte ou
|
||||
modifier des données cœur déjà validées.</p>
|
||||
<p>Si l'usager est mineur, son identité ne peut pas être validée. Pour l'accès au service, merci de se référer au protocole d'accès du partenaire</p>
|
||||
</li>
|
||||
</ul>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -15,72 +15,72 @@
|
|||
|
||||
|
||||
{% block content %}
|
||||
<p>Validation demandée par {{ validation_request.origin }} le {{ validation_request.created }}, identifiant externe de la demande <em>{{ validation_request.external_id }}</em>.</p>
|
||||
<p>Validation demandée par {{ validation_request.origin }} le {{ validation_request.created }}, identifiant externe de la demande <em>{{ validation_request.external_id }}</em>.</p>
|
||||
|
||||
{% if validation_request.validated %}
|
||||
{% with agent=validation_request.validated_by %}
|
||||
<p>Demande {{ validation_request.get_status_display }} le {{ validation_request.validated }} par <a href="{% url "a2-manager-user-detail" pk=agent.pk %}">{{ agent.get_full_name }}</a></p>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% if validation_request.taken_by != user and validation_request.is_taken %}
|
||||
<p>Demande en cours de traitement par {{ validation_request.taken_by }} depuis le {{ validation_request.taken }}</p>
|
||||
{% if validation_request.validated %}
|
||||
{% with agent=validation_request.validated_by %}
|
||||
<p>Demande {{ validation_request.get_status_display }} le {{ validation_request.validated }} par <a href="{% url "a2-manager-user-detail" pk=agent.pk %}">{{ agent.get_full_name }}</a></p>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% if validation_request.taken_by != user and validation_request.is_taken %}
|
||||
<p>Demande en cours de traitement par {{ validation_request.taken_by }} depuis le {{ validation_request.taken }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
$('body').on('click', 'a.popup-image', function (event) {
|
||||
var target = event.target;
|
||||
var src = $(target).parent('a')[0].href;
|
||||
var vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
var vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
var ratio_width = target.width / (vw - 100);
|
||||
var ratio_height = target.height / (vh - 100);
|
||||
var ratio = Math.max(ratio_width, ratio_height);
|
||||
var new_width = target.width / ratio;
|
||||
var new_height = target.height / ratio;
|
||||
var $overlay = $('<img src="' + src +'"/>');
|
||||
$overlay.css({
|
||||
'position': 'fixed',
|
||||
'height': '' + new_height + 'px',
|
||||
'width': '' + new_width + 'px',
|
||||
'top': 0,
|
||||
'left': 0,
|
||||
'padding-left': ((vw - new_width) / 2) + 'px',
|
||||
'padding-right': ((vw - new_width) / 2) + 'px',
|
||||
'padding-top': ((vh - new_height) / 2) + 'px',
|
||||
'padding-bottom': ((vh - new_height) / 2) + 'px',
|
||||
'z-index': 999,
|
||||
})
|
||||
<script>
|
||||
$('body').on('click', 'a.popup-image', function (event) {
|
||||
var target = event.target;
|
||||
var src = $(target).parent('a')[0].href;
|
||||
var vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
var vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
var ratio_width = target.width / (vw - 100);
|
||||
var ratio_height = target.height / (vh - 100);
|
||||
var ratio = Math.max(ratio_width, ratio_height);
|
||||
var new_width = target.width / ratio;
|
||||
var new_height = target.height / ratio;
|
||||
var $overlay = $('<img src="' + src +'"/>');
|
||||
$overlay.css({
|
||||
'position': 'fixed',
|
||||
'height': '' + new_height + 'px',
|
||||
'width': '' + new_width + 'px',
|
||||
'top': 0,
|
||||
'left': 0,
|
||||
'padding-left': ((vw - new_width) / 2) + 'px',
|
||||
'padding-right': ((vw - new_width) / 2) + 'px',
|
||||
'padding-top': ((vh - new_height) / 2) + 'px',
|
||||
'padding-bottom': ((vh - new_height) / 2) + 'px',
|
||||
'z-index': 999,
|
||||
})
|
||||
|
||||
$overlay.appendTo($('body'));
|
||||
$overlay.on('click', function () {
|
||||
$overlay.remove();
|
||||
});
|
||||
event.preventDefault();
|
||||
})
|
||||
</script>
|
||||
<div id="attachments">
|
||||
$overlay.appendTo($('body'));
|
||||
$overlay.on('click', function () {
|
||||
$overlay.remove();
|
||||
});
|
||||
event.preventDefault();
|
||||
})
|
||||
</script>
|
||||
<div id="attachments">
|
||||
<h4>Pièces jointes</h4>
|
||||
<p>
|
||||
{% for attachment in attachments %}
|
||||
<a
|
||||
{% if attachment.extension != 'pdf' %}
|
||||
class="popup-image"
|
||||
{% endif %}
|
||||
target="_blank"
|
||||
href="{{ attachment.url }}">
|
||||
<img
|
||||
src="{{ attachment.thumbnail_image.src }}"
|
||||
title="Pièce jointe {{ forloop.counter }}"
|
||||
style="border: 1px solid black; padding: 1ex"/>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% for attachment in attachments %}
|
||||
<a
|
||||
{% if attachment.extension != 'pdf' %}
|
||||
class="popup-image"
|
||||
{% endif %}
|
||||
target="_blank"
|
||||
href="{{ attachment.url }}">
|
||||
<img
|
||||
src="{{ attachment.thumbnail_image.src }}"
|
||||
title="Pièce jointe {{ forloop.counter }}"
|
||||
style="border: 1px solid black; padding: 1ex"/>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
<h4>Identité</h4>
|
||||
<div>
|
||||
{{ block.super }}
|
||||
</div>
|
||||
</div>
|
||||
<h4>Identité</h4>
|
||||
<div>
|
||||
{{ block.super }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block beforeform %}
|
||||
|
@ -96,16 +96,16 @@ $('body').on('click', 'a.popup-image', function (event) {
|
|||
{% endblock %}
|
||||
|
||||
{% block buttons %}
|
||||
{% if not validation_request.validated %}
|
||||
<div class="buttons">
|
||||
<button name="validate">Valider</button>
|
||||
</div>
|
||||
<h4>Refus</h4>
|
||||
{{ validation_form.as_p }}
|
||||
{% if not validation_request.validated %}
|
||||
<div class="buttons">
|
||||
<button name="validate">Valider</button>
|
||||
</div>
|
||||
<h4>Refus</h4>
|
||||
{{ validation_form.as_p }}
|
||||
|
||||
<div class="buttons">
|
||||
<button name="refuse">Refuser</button>
|
||||
<button style="float: right; margin-right: 30px" name="next">Suivant</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="buttons">
|
||||
<button name="refuse">Refuser</button>
|
||||
<button style="float: right; margin-right: 30px" name="next">Suivant</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
{% block appbar %}
|
||||
<h2>Validation d'identité
|
||||
</h2>
|
||||
</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
|
@ -16,9 +16,9 @@
|
|||
<p>
|
||||
<h2>Filtres</h2>
|
||||
{% if request.GET.all %}
|
||||
<a href="?">Uniquement les demandes reçues</a>
|
||||
<a href="?">Uniquement les demandes reçues</a>
|
||||
{% else %}
|
||||
<a href="?all=1">Toutes les demandes</a>
|
||||
<a href="?all=1">Toutes les demandes</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% block main %}
|
||||
<style>
|
||||
#validation-request-table tbody .human_status {
|
||||
text-align: left;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
{% with row_link=1 %}
|
||||
|
|
|
@ -16,35 +16,35 @@
|
|||
|
||||
from authentic2.decorators import required
|
||||
from authentic2.manager.utils import manager_login_required
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import api_views, views
|
||||
|
||||
urlpatterns = required(
|
||||
manager_login_required,
|
||||
[
|
||||
url('^accounts/edit-core/$', views.edit_core, name='cut-edit-core'),
|
||||
url('^accounts/edit-crown/$', views.edit_crown, name='cut-edit-crown'),
|
||||
url(r'^manage/users/(?P<pk>\d+)/$', views.manager_user_detail, name='a2-manager-user-detail'),
|
||||
url(
|
||||
path('accounts/edit-core/', views.edit_core, name='cut-edit-core'),
|
||||
path('accounts/edit-crown/', views.edit_crown, name='cut-edit-crown'),
|
||||
path('manage/users/<int:pk>/', views.manager_user_detail, name='a2-manager-user-detail'),
|
||||
re_path(
|
||||
r'^manage/users/uuid:(?P<slug>[a-z0-9]+)/$',
|
||||
views.manager_user_detail,
|
||||
name='a2-manager-user-by-uuid-detail',
|
||||
),
|
||||
url(
|
||||
r'^manage/users/(?P<pk>\d+)/edit-core/$',
|
||||
path(
|
||||
'manage/users/<int:pk>/edit-core/',
|
||||
views.manager_user_edit_core,
|
||||
name='cut-manager-user-edit-core',
|
||||
),
|
||||
url('^manage/validation/$', views.validation_homepage, name='cut-manager-user-validation'),
|
||||
url('^manage/validation/next/$', views.next_validation, name='cut-manager-user-next-validation'),
|
||||
url(r'^manage/validation/(?P<pk>\d+)/$', views.validation, name='cut-manager-user-validation'),
|
||||
url(
|
||||
path('manage/validation/', views.validation_homepage, name='cut-manager-user-validation'),
|
||||
path('manage/validation/next/', views.next_validation, name='cut-manager-user-next-validation'),
|
||||
path('manage/validation/<int:pk>/', views.validation, name='cut-manager-user-validation'),
|
||||
re_path(
|
||||
r'^manage/validation/attachment/(?P<pk>\d*)/(?P<filename>.*)$',
|
||||
views.validation_attachment,
|
||||
name='cut-manager-user-validation-attachment',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^manage/validation/attachment-thumbnail/(?P<pk>\d*)/(?P<filename>.*)$',
|
||||
views.validation_attachment_thumbnail,
|
||||
name='cut-manager-user-validation-attachment-thumbnail',
|
||||
|
@ -53,6 +53,6 @@ urlpatterns = required(
|
|||
)
|
||||
|
||||
urlpatterns += [
|
||||
url('^cgu/$', views.cgu, name='cut-cgu'),
|
||||
url('^api/validate/$', api_views.validate, name='api-cut-validate'),
|
||||
path('cgu/', views.cgu, name='cut-cgu'),
|
||||
path('api/validate/', api_views.validate, name='api-cut-validate'),
|
||||
]
|
||||
|
|
|
@ -27,7 +27,7 @@ from django.core.exceptions import PermissionDenied
|
|||
from django.db.transaction import atomic
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
from . import forms, models, tables, utils
|
||||
|
|
|
@ -4,7 +4,7 @@ ALLOWED_HOSTS = ['localhost']
|
|||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'authentic2-cut',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import uuid
|
|||
|
||||
import pytest
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_str
|
||||
from utils import login
|
||||
|
||||
from authentic2_cut import models
|
||||
|
@ -60,7 +60,7 @@ def helper_test_validation_image(glc_app, john, image_file, extension):
|
|||
'external_id': external_id,
|
||||
'justificatifs': [
|
||||
{
|
||||
'b64_content': force_text(base64.b64encode(image_file)),
|
||||
'b64_content': force_str(base64.b64encode(image_file)),
|
||||
}
|
||||
],
|
||||
},
|
||||
|
@ -109,13 +109,13 @@ def test_many_attachments(app, admin, glc_app, john, png_file, jpeg_file, pdf_fi
|
|||
'external_id': external_id,
|
||||
'justificatifs': [
|
||||
{
|
||||
'b64_content': force_text(base64.b64encode(png_file)),
|
||||
'b64_content': force_str(base64.b64encode(png_file)),
|
||||
},
|
||||
{
|
||||
'b64_content': force_text(base64.b64encode(jpeg_file)),
|
||||
'b64_content': force_str(base64.b64encode(jpeg_file)),
|
||||
},
|
||||
{
|
||||
'b64_content': force_text(base64.b64encode(pdf_file)),
|
||||
'b64_content': force_str(base64.b64encode(pdf_file)),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue