diff --git a/app/auth/models.py b/app/auth/models.py index 20149e14a..dc9e32fc7 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):