Skip to content

Commit

Permalink
[IMP] password_security: add flag to enable/disable password security…
Browse files Browse the repository at this point in the history
… policy
  • Loading branch information
ajaniszewska-dev committed Mar 20, 2023
1 parent d98ffa7 commit ae570f2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions password_security/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
class ResCompany(models.Model):
_inherit = "res.company"

password_policy_enabled = fields.Boolean(default=False)

password_expiration = fields.Integer(
"Days",
default=60,
Expand Down
3 changes: 3 additions & 0 deletions password_security/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

password_policy_enabled = fields.Boolean(
related="company_id.password_policy_enabled", readonly=False
)
password_expiration = fields.Integer(
related="company_id.password_expiration", readonly=False
)
Expand Down
14 changes: 14 additions & 0 deletions password_security/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
<div class="o_setting_right_pane">
<label string="Password Policy" for="password_expiration" />
<div class="content-group">
<div class="mt16">
<span>
Password policy enabled
<field
name="password_policy_enabled"
class="oe_inline"
/>
</span>
</div>
</div>
<div
class="content-group"
attrs="{'invisible': [('password_policy_enabled','=', False)]}"
>
<div class="mt16">
<span>
Password expires in
Expand Down

0 comments on commit ae570f2

Please sign in to comment.