密码模块修改

This commit is contained in:
qihao.gong@jikimo.com
2023-07-13 17:31:16 +08:00
parent 3544c6a957
commit 5e8e380a8e
3 changed files with 40 additions and 43 deletions

View File

@@ -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 之间"))