Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
Showing only changes of commit 1c6e54c76c - Show all commits

View File

@ -302,6 +302,10 @@ class User(UserMixin, db.Model, ScoDocModel):
if field in args: if field in args:
args[field] = args[field] or "" 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 return args_dict
def from_dict(self, data: dict, new_user=False): 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") exp = ScoDocSiteConfig.get("cas_uid_from_mail_regexp")
if exp and self.email_institutionnel: if exp and self.email_institutionnel:
cas_id = ScoDocSiteConfig.extract_cas_id(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 self.cas_id = cas_id
def get_token(self, expires_in=3600): def get_token(self, expires_in=3600):