From 31d48a56ff432175994ffabf1a15dfbc1ab49b3b Mon Sep 17 00:00:00 2001 From: Jean-Marie PLACE Date: Tue, 25 Jan 2022 08:44:20 +0100 Subject: [PATCH 1/2] fix_user ; always send from no-reply ; reset passwd_temp --- app/auth/models.py | 1 + app/views/users.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/auth/models.py b/app/auth/models.py index 8f187b7e..32768df0 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -112,6 +112,7 @@ class User(UserMixin, db.Model): self.password_hash = generate_password_hash(password) else: self.password_hash = None + self.passwd_temp = False def check_password(self, password): """Check given password vs current one. diff --git a/app/views/users.py b/app/views/users.py index fe65348c..59175344 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -154,7 +154,7 @@ def create_user_form(user_name=None, edit=0, all_roles=1): if user_name is not None: # scodoc7func converti en int ! user_name = str(user_name) auth_dept = current_user.dept - from_mail = current_user.email + from_mail = current_app.config["SCODOC_MAIL_FROM"] # current_user.email initvalues = {} edit = int(edit) all_roles = int(all_roles) @@ -577,8 +577,8 @@ def create_user_form(user_name=None, edit=0, all_roles=1): # A: envoi de welcome + procedure de reset # B: envoi de welcome seulement (mot de passe saisie dans le formulaire) # C: Aucun envoi (mot de passe saisi dans le formulaire) - if vals["welcome"] == "1": - if vals["reset_password:list"] == "1": + if vals["welcome"] != "1": + if vals["reset_password"] != "1": mode = Mode.WELCOME_AND_CHANGE_PASSWORD else: mode = Mode.WELCOME_ONLY From 4133b9df6a0f67a71f6a5af6bd8a9668b3f7c815 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 25 Jan 2022 13:24:08 +0100 Subject: [PATCH 2/2] =?UTF-8?q?R=C3=A9glage=20publication=20bulletin=20JSO?= =?UTF-8?q?N?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/bulletin_but.py | 11 +++++++++-- app/scodoc/sco_bulletins_json.py | 4 ++-- app/views/notes.py | 5 ++++- sco_version.py | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index eac6d52c..1c45d6e0 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -219,13 +219,18 @@ class ResultatsSemestreBUT: } return d - def bulletin_etud(self, etud, formsemestre) -> dict: - """Le bulletin de l'étudiant dans ce semestre""" + def bulletin_etud(self, etud, formsemestre, force_publishing=False) -> dict: + """Le bulletin de l'étudiant dans ce semestre. + Si force_publishing, rempli le bulletin même si bul_hide_xml est vrai + (bulletins non publiés). + """ etat_inscription = etud.etat_inscription(formsemestre.id) + published = (not formsemestre.bul_hide_xml) or force_publishing d = { "version": "0", "type": "BUT", "date": datetime.datetime.utcnow().isoformat() + "Z", + "publie": not formsemestre.bul_hide_xml, "etudiant": etud.to_dict_bul(), "formation": { "id": formsemestre.formation.id, @@ -237,6 +242,8 @@ class ResultatsSemestreBUT: "etat_inscription": etat_inscription, "options": bulletin_option_affichage(formsemestre), } + if not published: + return d semestre_infos = { "etapes": [str(x.etape_apo) for x in formsemestre.etapes if x.etape_apo], "date_debut": formsemestre.date_debut.isoformat(), diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index c3812e74..cb31ed14 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -98,9 +98,9 @@ def formsemestre_bulletinetud_published_dict( d = {} if (not sem["bul_hide_xml"]) or force_publishing: - published = 1 + published = True else: - published = 0 + published = False if xml_nodate: docdate = "" else: diff --git a/app/views/notes.py b/app/views/notes.py index 4be64afb..c9da6f64 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -307,7 +307,9 @@ def formsemestre_bulletinetud( ) if format == "json": r = bulletin_but.ResultatsSemestreBUT(formsemestre) - return jsonify(r.bulletin_etud(etud, formsemestre)) + return jsonify( + r.bulletin_etud(etud, formsemestre, force_publishing=force_publishing) + ) elif format == "html": return render_template( "but/bulletin.html", @@ -318,6 +320,7 @@ def formsemestre_bulletinetud( formsemestre_id=formsemestre_id, etudid=etudid, format="json", + force_publishing=1, # pour ScoDoc lui même ), sco=ScoData(), ) diff --git a/sco_version.py b/sco_version.py index 55a2c785..9540dbe5 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.32" +SCOVERSION = "9.1.33" SCONAME = "ScoDoc"