Skip to content

Commit

Permalink
Merge pull request #497 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/server-auth (16.0)
  • Loading branch information
bt-admin authored Sep 20, 2024
2 parents 4fe1551 + fc90688 commit 2129632
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ addon | version | maintainers | summary
[auth_user_case_insensitive](auth_user_case_insensitive/) | 16.0.1.0.0 | | Makes the user login field case insensitive
[base_user_show_email](base_user_show_email/) | 16.0.1.0.0 | | Untangle user login and email
[impersonate_login](impersonate_login/) | 16.0.1.0.0 | [![Kev-Roche](https://github.com/Kev-Roche.png?size=30px)](https://github.com/Kev-Roche) | tools
[password_security](password_security/) | 16.0.1.0.1 | | Allow admin to set password security requirements.
[password_security](password_security/) | 16.0.1.0.2 | | Allow admin to set password security requirements.
[user_log_view](user_log_view/) | 16.0.1.0.0 | [![trojikman](https://github.com/trojikman.png?size=30px)](https://github.com/trojikman) | Allow to see user's actions log
[users_ldap_groups](users_ldap_groups/) | 16.0.1.0.0 | | Adds user accounts to groups based on rules defined by the administrator.
[users_ldap_mail](users_ldap_mail/) | 16.0.1.0.0 | [![joao-p-marques](https://github.com/joao-p-marques.png?size=30px)](https://github.com/joao-p-marques) | LDAP mapping for user name and e-mail
Expand Down
2 changes: 1 addition & 1 deletion password_security/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Password Security
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9568694ae7773332e8d20909a814c812a69b1ef5a9041a0259ef6cb85347e1ac
!! source digest: sha256:17ea471173d7da0eae34d429cb275fece9aa7379f01d834c95989150c5759f85
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
1 change: 1 addition & 0 deletions password_security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import controllers, models
from .hooks import post_init_hook
3 changes: 2 additions & 1 deletion password_security/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Password Security",
"summary": "Allow admin to set password security requirements.",
"version": "16.0.1.0.1",
"version": "16.0.1.0.2",
"author": "LasLabs, "
"Onestein, "
"Kaushal Prajapati, "
Expand All @@ -29,4 +29,5 @@
"demo/res_users.xml",
],
"installable": True,
"post_init_hook": "post_init_hook",
}
16 changes: 16 additions & 0 deletions password_security/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Vauxoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


def post_init_hook(cr, registry):
# Set password date for already existing users
cr.execute(
"""
UPDATE
res_users
SET
password_write_date = NOW() at time zone 'UTC'
WHERE
password_write_date IS NULL;
"""
)
12 changes: 12 additions & 0 deletions password_security/migrations/16.0.1.0.2/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def migrate(cr, version):
# Set password date for already existing users
cr.execute(
"""
UPDATE
res_users
SET
password_write_date = NOW() at time zone 'UTC'
WHERE
password_write_date IS NULL;
"""
)
5 changes: 1 addition & 4 deletions password_security/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ def _validate_pass_reset(self):
if pass_min <= 0:
continue
write_date = user.password_write_date
if not write_date:
continue
delta = timedelta(hours=pass_min)
if write_date + delta > datetime.now():
if write_date and write_date + timedelta(hours=pass_min) > datetime.now():
raise UserError(
_(
"Passwords can only be reset every %d hour(s). "
Expand Down
2 changes: 1 addition & 1 deletion password_security/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Password Security</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9568694ae7773332e8d20909a814c812a69b1ef5a9041a0259ef6cb85347e1ac
!! source digest: sha256:17ea471173d7da0eae34d429cb275fece9aa7379f01d834c95989150c5759f85
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/16.0/password_security"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-password_security"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows admin to set company-level password security requirements
Expand Down

0 comments on commit 2129632

Please sign in to comment.