CAS: améliore formulaire config.

This commit is contained in:
Emmanuel Viennet 2023-03-09 11:59:58 +01:00
parent 98b8a0a95a
commit d97f04a8ad
6 changed files with 54 additions and 18 deletions

View File

@ -92,7 +92,7 @@ class ScoDocSiteConfig(db.Model):
"cas_server": str, "cas_server": str,
"cas_login_route": str, "cas_login_route": str,
"cas_logout_route": str, "cas_logout_route": str,
"cas_valmidate_route": str, "cas_validate_route": str,
"cas_attribute_id": str, "cas_attribute_id": str,
} }

View File

@ -4575,8 +4575,21 @@ div.cas_link {
margin-top: 16px; margin-top: 16px;
} }
div.cas_etat_certif_ssl { div.cas_settings {
margin-top: 12px; margin-left: -15px;
font-style: italic; margin-bottom: 8px;
border: 1px dashed black; border: 1px dashed rgb(191, 34, 191);
background-color: #feb4e54f;
}
div.cas_settings>div,
div.cas_settings div.form-group {
margin-left: 8px;
}
div.cas_etat_certif_ssl {
margin-top: -15px;
margin-bottom: 8px;
font-style: italic;
color: rgb(231, 0, 0);
} }

View File

@ -10,20 +10,40 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
{{ wtf.quick_form(form) }}
<div class="cas_etat_certif_ssl">Certificat SSL <form class="form form-horizontal" method="post" role="form">
{% if cas_ssl_certificate_loaded %} {{ form.hidden_tag() }}
chargé. {{ wtf.form_errors(form, hiddens="only") }}
{% else %}
non chargé. {{ wtf.form_field(form.cas_enable) }}
{% endif %} {{ wtf.form_field(form.cas_force) }}
{{ wtf.form_field(form.cas_server) }}
{{ wtf.form_field(form.cas_login_route) }}
{{ wtf.form_field(form.cas_logout_route) }}
{{ wtf.form_field(form.cas_validate_route) }}
{{ wtf.form_field(form.cas_attribute_id) }}
<div class="cas_settings">
{{ wtf.form_field(form.cas_ssl_verify) }}
{{ wtf.form_field(form.cas_ssl_certificate_file) }}
<div class="cas_etat_certif_ssl">Certificat SSL
{% if cas_ssl_certificate_loaded %}
chargé.
{% else %}
non chargé.
{% endif %}
</div>
</div> </div>
<div style="margin-top:16px;"> <div class="form-group">
{{ wtf.form_field(form.submit) }}
{{ wtf.form_field(form.cancel) }}
</div>
<div class="form-group" style="margin-top:16px;">
<em>Note: si le CAS est forcé, le super-admin et les utilisateurs autorisés <em>Note: si le CAS est forcé, le super-admin et les utilisateurs autorisés
à "se connecter via ScoDoc" pourront toujours se à "se connecter via ScoDoc" pourront toujours se
connecter via l'adresse spéciale</em> connecter via l'adresse spéciale</em>
<tt style="color: blue;">{{url_for("auth.login_scodoc", _external=True)}}</tt> <tt style="color: blue;">{{url_for("auth.login_scodoc", _external=True)}}</tt>
</div> </div>
</form>
</div> </div>
</div> </div>

View File

@ -149,15 +149,15 @@ def config_cas():
if ScoDocSiteConfig.set("cas_force", form.data["cas_force"]): if ScoDocSiteConfig.set("cas_force", form.data["cas_force"]):
flash("CAS " + ("forcé" if form.data["cas_force"] else "non forcé")) flash("CAS " + ("forcé" if form.data["cas_force"] else "non forcé"))
if ScoDocSiteConfig.set("cas_server", form.data["cas_server"]): if ScoDocSiteConfig.set("cas_server", form.data["cas_server"]):
flash("Serveur CAS enregistré") flash("URL du serveur CAS enregistrée")
if ScoDocSiteConfig.set("cas_login_route", form.data["cas_login_route"]): if ScoDocSiteConfig.set("cas_login_route", form.data["cas_login_route"]):
flash("Serveur CAS enregistré") flash("Route du login CAS enregistrée")
if ScoDocSiteConfig.set("cas_logout_route", form.data["cas_logout_route"]): if ScoDocSiteConfig.set("cas_logout_route", form.data["cas_logout_route"]):
flash("Serveur CAS enregistré") flash("Route du logout CAS enregistrée")
if ScoDocSiteConfig.set("cas_validate_route", form.data["cas_validate_route"]): if ScoDocSiteConfig.set("cas_validate_route", form.data["cas_validate_route"]):
flash("Serveur CAS enregistré") flash("Route de validation CAS enregistrée")
if ScoDocSiteConfig.set("cas_attribute_id", form.data["cas_attribute_id"]): if ScoDocSiteConfig.set("cas_attribute_id", form.data["cas_attribute_id"]):
flash("Serveur CAS enregistré") flash("Attribut CAS ID enregistré")
if ScoDocSiteConfig.set("cas_ssl_verify", form.data["cas_ssl_verify"]): if ScoDocSiteConfig.set("cas_ssl_verify", form.data["cas_ssl_verify"]):
flash("Vérification SSL modifiée") flash("Vérification SSL modifiée")
if form.cas_ssl_certificate_file.data: if form.cas_ssl_certificate_file.data:
@ -175,6 +175,9 @@ def config_cas():
form.cas_enable.data = ScoDocSiteConfig.get("cas_enable") form.cas_enable.data = ScoDocSiteConfig.get("cas_enable")
form.cas_force.data = ScoDocSiteConfig.get("cas_force") form.cas_force.data = ScoDocSiteConfig.get("cas_force")
form.cas_server.data = ScoDocSiteConfig.get("cas_server") form.cas_server.data = ScoDocSiteConfig.get("cas_server")
form.cas_login_route.data = ScoDocSiteConfig.get("cas_login_route")
form.cas_logout_route.data = ScoDocSiteConfig.get("cas_logout_route")
form.cas_validate_route.data = ScoDocSiteConfig.get("cas_validate_route")
form.cas_attribute_id.data = ScoDocSiteConfig.get("cas_attribute_id") form.cas_attribute_id.data = ScoDocSiteConfig.get("cas_attribute_id")
form.cas_ssl_verify.data = ScoDocSiteConfig.get("cas_ssl_verify") form.cas_ssl_verify.data = ScoDocSiteConfig.get("cas_ssl_verify")
return render_template( return render_template(

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.4.61" SCOVERSION = "9.4.62"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"