diff --git a/data/mail_data.xml b/data/mail_data.xml index 46a176d1c33c4c9a81dafb17b4b07bc6429b32bd..8f7ba8546a1ac78fdd8882503295f156af205a57 100644 --- a/data/mail_data.xml +++ b/data/mail_data.xml @@ -86,14 +86,22 @@ >accéder aux différents contrats liés à votre opération : contrat d’achat local, contrats avec la personne morale organisatrice…</li> </ul> - <p>Votre nom d'utilisateur: ${object.email or ''}<br/> - Lien d’initialisation de votre mot de passe: <br/> - <a href="${'user_signup_url' in ctx and ctx['user_signup_url'] or ''}"> + <p + >Votre nom d'utilisateur: ${object.email or ''}<br + /> + Lien d’initialisation de votre mot de passe: <br + /> + <a + href="${'user_signup_url' in ctx and ctx['user_signup_url'] or ''}" + > ${'user_signup_url' in ctx and ctx['user_signup_url'] or ''} </a> </p><br /> - <p>Une fois votre mot de passe crée, vous pouvez accéder à la plateforme Elocoop en suivant ce lien : - <a href="${'portal_url' in ctx and ctx['portal_url'] or ''}">${'portal_url' in ctx and ctx['portal_url'] or ''}</a></p> + <p + >Une fois votre mot de passe crée, vous pouvez accéder à la plateforme Elocoop en suivant ce lien : + <a + href="${'portal_url' in ctx and ctx['portal_url'] or ''}" + >${'portal_url' in ctx and ctx['portal_url'] or ''}</a></p> <br /><br /> Bonne journée,<br /> L'équipe d'Elocoop diff --git a/models/__init__.py b/models/__init__.py index fd16339d9c73a52ac1032e11667da7b0b8c0a610..7a26aeed019ab851ae97722d01dc9c40e4ac68ea 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -4,3 +4,4 @@ from . import res_partner from . import res_company from . import res_config_settings +from . import res_users diff --git a/models/res_users.py b/models/res_users.py new file mode 100644 index 0000000000000000000000000000000000000000..fd05657e379f6c2bf1e84f89f53ddd4b6f597057 --- /dev/null +++ b/models/res_users.py @@ -0,0 +1,49 @@ +# Copyright 2022 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + def password_match_message(self): + self.ensure_one() + company_id = self.company_id + message = [] + if company_id.password_lower: + message.append( + _( + "\n* Lettre minuscule (au moins %s caractères)" + % str(company_id.password_lower) + ) + ) + if company_id.password_upper: + message.append( + _( + "\n* Lettre majuscule (au moins %s caractères)" + % str(company_id.password_upper) + ) + ) + if company_id.password_numeric: + message.append( + _( + "\n* Chiffre numérique (au moins %s caractères)" + % str(company_id.password_numeric) + ) + ) + if company_id.password_special: + message.append( + _( + "\n* Chiffre numérique (au moins %s caractères)" + % str(company_id.password_special) + ) + ) + if message: + message = [_("Doit contenir: ")] + message + if company_id.password_length: + message = [ + _("Le mot de passe doit contenir %d caractères ou plus.") + % company_id.password_length + ] + message + return "\r".join(message)