From 1c6e54c76c33df260dd22e6998387f06f98dd151 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Dec 2023 19:59:50 +0100 Subject: [PATCH] Fix: edition cas_id user --- app/auth/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/auth/models.py b/app/auth/models.py index 20149e14..dc9e32fc 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -302,6 +302,10 @@ class User(UserMixin, db.Model, ScoDocModel): if field in args: args[field] = args[field] or "" + # chaines ne devant pas ĂȘtre vides mais au contraire null (unicitĂ©) + if "cas_id" in args: + args["cas_id"] = args["cas_id"] or None + return args_dict def from_dict(self, data: dict, new_user=False): @@ -333,7 +337,7 @@ class User(UserMixin, db.Model, ScoDocModel): exp = ScoDocSiteConfig.get("cas_uid_from_mail_regexp") if exp and self.email_institutionnel: cas_id = ScoDocSiteConfig.extract_cas_id(self.email_institutionnel) - if cas_id is not None: + if cas_id: self.cas_id = cas_id def get_token(self, expires_in=3600):