diff --git a/app/auth/models.py b/app/auth/models.py index d39b02742b..18709de043 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -69,7 +69,7 @@ class User(UserMixin, db.Model): ) "Peut-on se logguer via le CAS ?" cas_allow_scodoc_login = db.Column( - db.Boolean, default=True, server_default="false", nullable=False + db.Boolean, default=False, server_default="false", nullable=False ) """(not yet implemented XXX) si CAS activé, peut-on se logguer sur ScoDoc directement ? @@ -221,7 +221,7 @@ class User(UserMixin, db.Model): data["email"] = self.email or "" return data - def from_dict(self, data, new_user=False): + def from_dict(self, data: dict, new_user=False): """Set users' attributes from given dict values. Roles must be encoded as "roles_string", like "Ens_RT, Secr_CJ" """ @@ -233,11 +233,16 @@ class User(UserMixin, db.Model): "email", "date_expiration", "cas_id", - "cas_allow_login", - "cas_allow_scodoc_login", ]: if field in data: setattr(self, field, data[field] or None) + # required boolean fields + for field in [ + "cas_allow_login", + "cas_allow_scodoc_login", + ]: + setattr(self, field, data.get(field, False)) + if new_user: if "user_name" in data: # never change name of existing users diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index 0c7e376227..0e805f0173 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -800,7 +800,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); elif input_type in ("radio", "menu", "checkbox", "boolcheckbox"): if input_type == "boolcheckbox": labels = descr.get( - "labels", descr.get("allowed_values", ["oui", "non"]) + "labels", descr.get("allowed_values", ["non", "oui"]) ) _val = self.values[field] if isinstance(_val, bool):