1
0
forked from ScoDoc/ScoDoc

Fix: edition cas_id user

This commit is contained in:
Emmanuel Viennet 2023-12-12 19:59:50 +01:00
parent 8166fd1380
commit 1c6e54c76c

View File

@ -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):