diff --git a/password_security/models/res_company.py b/password_security/models/res_company.py index f8b91169..c703b1f8 100644 --- a/password_security/models/res_company.py +++ b/password_security/models/res_company.py @@ -10,53 +10,51 @@ class ResCompany(models.Model): _inherit = "res.company" password_expiration = fields.Integer( - "Days", default=60, - help="How many days until passwords expire", + help="密码过期前多少天", + string='密码过期天数' ) password_length = fields.Integer( - "Characters", default=12, - help="Minimum number of characters", + help="最小字符数", + string='密码最低长度' ) password_lower = fields.Integer( - "Lowercase", default=1, - help="Require number of lowercase letters", + help="需要小写字母数", + string='密码中包含小写字母数(最少)' ) password_upper = fields.Integer( - "Uppercase", default=1, - help="Require number of uppercase letters", + string='密码中包含大写字母数(最少)' ) password_numeric = fields.Integer( - "Numeric", default=1, - help="Require number of numeric digits", + help="需要数字位数", + string='密码中包含数字(最少)' ) password_special = fields.Integer( - "Special", default=1, - help="Require number of unique special characters", + help="需要唯一特殊字符的数量", + string='密码中包含特殊字符(最少)' ) password_estimate = fields.Integer( - "Estimation", default=3, - help="Required score for the strength estimation. Between 0 and 4", + help="强度估计所需的分数。介于0和4之间", + string='密码强度等级' ) password_history = fields.Integer( - "History", default=30, - help="Disallow reuse of this many previous passwords - use negative " - "number for infinite, or 0 to disable", + help="禁止重复使用这许多以前的密码 - 使用负数字表示无限,或 0 表示禁用", + string='禁止重复使用这许多以前的密码-使用负数字表示无限,或0表示禁用' ) password_minimum = fields.Integer( - "Minimum Hours", default=24, - help="Amount of hours until a user may change password again", + help="用户再次更改密码之前的小时数", + string='更改密码间隔时长(小时)' ) @api.constrains("password_estimate") def _check_password_estimate(self): if 0 > self.password_estimate > 4: - raise ValidationError(_("The estimation must be between 0 and 4.")) + raise ValidationError(_("估计值必须介于 0 和 4 之间")) diff --git a/password_security/models/res_users.py b/password_security/models/res_users.py index dae39613..cbc03867 100644 --- a/password_security/models/res_users.py +++ b/password_security/models/res_users.py @@ -87,29 +87,29 @@ class ResUsers(models.Model): message = [] if company_id.password_lower: message.append( - _("\n* Lowercase letter (at least %s characters)") + _("\n* 小写字母(至少%s个字符)") % str(company_id.password_lower) ) if company_id.password_upper: message.append( - _("\n* Uppercase letter (at least %s characters)") + _("\n* 大写字母(至少%s个字符)") % str(company_id.password_upper) ) if company_id.password_numeric: message.append( - _("\n* Numeric digit (at least %s characters)") + _("\n* 数字(至少%s字符)") % str(company_id.password_numeric) ) if company_id.password_special: message.append( - _("\n* Special character (at least %s characters)") + _("\n* 特殊字符(至少%s个字符)") % str(company_id.password_special) ) if message: - message = [_("Must contain the following:")] + message + message = [_("必须包含以下内容:")] + message if company_id.password_length: message = [ - _("Password must be %d characters or more.") + _("密码必须为%d个字符或更多。") % company_id.password_length ] + message return "\r".join(message) @@ -173,8 +173,8 @@ class ResUsers(models.Model): if write_date + delta > datetime.now(): raise UserError( _( - "Passwords can only be reset every %d hour(s). " - "Please contact an administrator for assistance." + "密码只能每%d小时重置一次。 " + "请联系管理员寻求帮助。" ) % pass_min ) @@ -195,13 +195,12 @@ class ResUsers(models.Model): lambda r: crypt.verify(password, r.password_crypt) ): raise UserError( - _("Cannot use the most recent %d passwords") + _("无法使用使用过的莫玛(%d个密码内)") % rec_id.company_id.password_history ) def _set_encrypted_password(self, uid, pw): """It saves password crypt history for history rules""" res = super(ResUsers, self)._set_encrypted_password(uid, pw) - self.write({"password_history_ids": [(0, 0, {"password_crypt": pw})]}) return res diff --git a/password_security/views/res_config_settings_views.xml b/password_security/views/res_config_settings_views.xml index 7bcc8b2d..4e367c80 100644 --- a/password_security/views/res_config_settings_views.xml +++ b/password_security/views/res_config_settings_views.xml @@ -25,64 +25,64 @@
- Password expires in + 密码过期 - days. + 天
- User can change password in + 用户可以更改密码在 - hours again. + 小时之后.
- Disallow reuse of + 禁止重复使用 - previous passwords. + 以前的密码.
- Use negative number for infinite, or 0 to disable + 使用负数表示无限,或使用 0 禁用
- Minimum number of characters + 最小字符数
- Minimum number of lowercase characters + 最少小写字符数
- Minimum number of uppercase characters + 最少大写字符数
- Minimum number of numeric characters + 最小数字字符数
- Minimum number of special characters + 最小特殊字符数
- Minimum number of strength estimation + 最小强度估计数