Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
b75506c
[9.0][ADD] Password Security Settings (#531)
lasley Sep 29, 2016
d8119c4
[MIG] Make modules uninstallable
pedrobaeza Oct 6, 2016
264932e
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
2e082f8
[MIG] password_security: Migrate to v10
lasley Oct 20, 2016
1208bea
[FIX] password_security: Validate admin pass
lasley Dec 23, 2016
1049dac
[FIX] password_security: Fix history rule
lasley Jan 9, 2017
2005b4c
Improve UX password_match_message()
astirpe May 5, 2017
49ad8a1
[FIX] password_security: Fix password stored and token to reset passw…
moylop260 Jun 20, 2017
8a08fe1
[FIX] password_security: Force password reset
obulkin Sep 18, 2017
4e5d25a
[MIG]password security
smurf-U Oct 11, 2017
9218b61
[IMP]change request
smurf-U Oct 27, 2017
d48cc8a
[IMP]Underscore is a special character #1077
StefanRijnhart Nov 29, 2017
0f1f341
[FIX] password_security: Default last write date #1084
lasley Dec 4, 2017
b535a99
[FIX] UTF-8 coding is not necessary
max3903 Mar 28, 2018
78450ec
[MIG] auth_totp_password_security: Migration to 11.0
MiquelRForgeFlow May 14, 2018
a7a24f8
[I18N] password_security: Translate to Spanish all translatable terms
luisg123v Jun 18, 2018
a5973ee
[FIX] password_security: Error 500 when login with bad password (#27)
yajo Jun 19, 2018
703d023
[FIX] password_security: Allow mini-admin to create users (#31)
yajo Jun 22, 2018
c1bfb07
[FIX] password_security: Make tests pass if website is installed
yajo Nov 27, 2018
571c912
[MIG] password_security: Migration to 12.0
shepilov-vladislav Apr 12, 2019
12c0384
[FIX] password_security: correct readme fragments
sbidoul May 11, 2019
d930eb8
[FIX] 12.0 `password_security` - Reset Password
amkarthik Jul 18, 2019
a0ab4bd
[FIX] 12.0 `password_security` - Reset Password
amkarthik Jul 22, 2019
7f5c35b
Add zxcvbn to password security
fkantelberg Sep 1, 2019
1a2b5f2
Force add zxcvbn js lib
fkantelberg Sep 7, 2019
6072953
Translated using Weblate (Croatian)
badbole Nov 13, 2019
f029022
[FIX] [12.0] password_security - redirection fails when password_secu…
amkarthik Jul 23, 2019
3bc2a27
making password_security compatible with odoo 13.0
Moro-Code Apr 23, 2020
fbc5d06
add external dependency
Moro-Code Apr 27, 2020
a99e929
Translated using Weblate (Portuguese)
pedrocs-exo Oct 12, 2020
14e0c85
Translated using Weblate (Portuguese)
pedrocs-exo Oct 13, 2020
03bb4f9
Reformat password_security to match tests
llacroix Dec 10, 2020
1452db2
[MIG] Migrated the module in v14.
Chandresh-SerpentCS Feb 10, 2021
0f26716
[IMP] Improved the code.
Chandresh-SerpentCS Feb 22, 2021
29d524d
[FIX] password_policy: error messages properly presented to the user
dreispt Mar 25, 2021
aae9392
Translated using Weblate (Finnish)
jarmokortetjarvi Nov 17, 2021
ada332b
Translated using Weblate (Swedish)
beremavertel Feb 9, 2022
7e68f39
Translated using Weblate (Swedish)
beremavertel Feb 10, 2022
3cb560f
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 31, 2022
e677711
[IMP] password_security: black, isort, prettier
dsolanki-initos Jan 9, 2023
64e8586
[MIG] password_security: Migration to 15.0
dsolanki-initos Jan 9, 2023
1c1605c
[16.0][MIG] password_security
astirpe Feb 20, 2023
027bfcd
[MIG] password_security: migration of password_length
astirpe Mar 10, 2023
ce22426
[MIG] password_security: explicit super()
astirpe Mar 10, 2023
c37cf7a
[FIX] password_security: access rights for portal user with replacement
astirpe May 31, 2023
8d3068f
[FIX] password_security: compatibility with 2FA
astirpe Jun 15, 2023
9bc7481
[FIX] password_security: fix _order of res.users.pass.history
astirpe Jul 25, 2023
edd1303
[FIX] password_security: fix test on missing partner given for new user
astirpe Jul 25, 2023
9bd66a1
[FIX] password_security: adapt test to auth_signup_verify_email
astirpe Jul 25, 2023
3ece472
[IMP] password_security: config settings refactoring
astirpe Jul 25, 2023
64ca77e
[IMP] password_security: remove password_estimate
astirpe Jul 27, 2023
f44ef54
Update password_security/views/res_config_settings_views.xml
astirpe Aug 7, 2023
e1d0251
Translated using Weblate (Italian)
mymage Oct 13, 2023
1d65a57
Translated using Weblate (Italian)
francesco-ooops Oct 13, 2023
eb1a863
Translated using Weblate (Spanish)
Ivorra78 Oct 15, 2023
ec9a38d
Translated using Weblate (Italian)
mymage Jan 4, 2024
34e7d5e
[IMP] password_security: pre-commit stuff
Jan 31, 2024
064b318
[MIG] password_security: Migration to 17.0
Jan 31, 2024
f32fd13
[IMP] password_security: use ir.config_parameter
alexis-via Nov 16, 2024
af112f9
[IMP] password_security: pre-commit auto fixes
IsabelAForgeFlow Mar 10, 2025
479862c
[MIG] password_security: Migration to 18.0
IsabelAForgeFlow Mar 10, 2025
7e1e26c
[FIX] password_security: password expiration 2FA
Jan 21, 2022
f7ead41
Translated using Weblate (French)
ypapouin Jun 12, 2026
b569fc3
Translated using Weblate (Slovenian)
sysadminmatmoz Jul 9, 2026
be869c5
Translated using Weblate (Slovenian)
sysadminmatmoz Jul 9, 2026
c623359
[FIX] password_security: sudo password history read for reuse
LauraCForgeFlow Jul 16, 2026
f245a37
[IMP] password_security: pre-commit auto fixes
moylop260 Aug 14, 2026
5637cdd
[MIG] password_security: Migration to 19.0
moylop260 Aug 14, 2026
8c96bae
[FIX] auth_api_key: strong test password
moylop260 Aug 14, 2026
937be6b
[FIX] impersonate_login: strong test password
moylop260 Aug 14, 2026
f3a45eb
[IMP] password_security: cover web_totp with a test
moylop260 Aug 15, 2026
5e73230
[ADD] user_log_view
Dec 26, 2019
b81df6b
[UPD] README.rst
OCA-git-bot May 29, 2020
227a79a
[ADD] icon.png
OCA-git-bot May 29, 2020
abe4306
[UPD] Update user_log_view.pot
oca-travis Nov 30, 2020
05ab3b1
[MIG] Module migration in v14.
Chandresh-SerpentCS Feb 10, 2021
973fdda
[UPD] Update user_log_view.pot
oca-travis Mar 4, 2021
3d95d0b
[UPD] README.rst
OCA-git-bot Mar 4, 2021
88299d1
[MIG] user_log_view: Migration to 16.0
Borruso Jun 22, 2023
1a213a1
[UPD] Update user_log_view.pot
Aug 22, 2023
096afa1
[UPD] README.rst
OCA-git-bot Aug 22, 2023
2b0accd
[UPD] README.rst
OCA-git-bot Sep 3, 2023
40b80cc
Added translation using Weblate (Italian)
mymage Dec 28, 2023
2c58c6a
Translated using Weblate (Italian)
mymage Jan 3, 2024
150c317
[IMP] user_log_view: pre-commit auto fixes
Tisho99 Feb 28, 2024
98ec41f
[17.0] [MIG] user_log_view
Tisho99 Feb 28, 2024
ac16d9b
[UPD] Update user_log_view.pot
Feb 28, 2024
612bf01
[BOT] post-merge updates
OCA-git-bot Feb 28, 2024
585cac5
[IMP] user_log_view: pre-commit auto fixes
kobros-tech Apr 10, 2025
efe57e4
[MIG] user_log_view: Migration to 18.0
Oct 15, 2024
8d4a0ca
[UPD] Update user_log_view.pot
Oct 13, 2025
91925da
[BOT] post-merge updates
OCA-git-bot Oct 13, 2025
71a8ef8
[IMP] user_log_view: pre-commit auto fixes
mmrondon Jan 12, 2026
6da85e8
[MIG] user_log_view: Migration to 19.0
mmrondon Jan 12, 2026
f6a7ad7
Merge PR #980 into 19.0
OCA-git-bot Aug 19, 2026
06cd14a
[UPD] Update password_security.pot
Aug 19, 2026
e5e7c7d
[BOT] post-merge updates
OCA-git-bot Aug 19, 2026
708228d
Merge PR #981 into 19.0
OCA-git-bot Aug 19, 2026
00fadf2
[UPD] Update user_log_view.pot
Aug 19, 2026
f103974
[BOT] post-merge updates
OCA-git-bot Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ addon | version | maintainers | summary
[auth_session_timeout](auth_session_timeout/) | 19.0.1.0.0 | | This module disable all inactive sessions since a given delay
[auth_user_case_insensitive](auth_user_case_insensitive/) | 19.0.1.0.0 | | Makes the user login field case insensitive
[impersonate_login](impersonate_login/) | 19.0.1.0.1 | <a href='https://github.com/Kev-Roche'><img src='https://github.com/Kev-Roche.png' width='32' height='32' style='border-radius:50%;' alt='Kev-Roche'/></a> | tools
[password_security](password_security/) | 19.0.1.0.0 | | Allow admin to set password security requirements.
[user_log_view](user_log_view/) | 19.0.1.0.0 | <a href='https://github.com/trojikman'><img src='https://github.com/trojikman.png' width='32' height='32' style='border-radius:50%;' alt='trojikman'/></a> | Allow to see user's actions log

[//]: # (end addons)

Expand Down
4 changes: 3 additions & 1 deletion auth_api_key/tests/test_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def setUpClass(cls):
cls.env,
name="Test User",
login="test",
password="test",
# Strong enough for password_security, which lands in the same
# database on the CI and enforces its policy on every user.
password="Test!2345",
email="test@test.com",
group_ids=[cls.env.ref("base.group_user").id],
company_id=cls.env.company.id,
Expand Down
2 changes: 1 addition & 1 deletion impersonate_login/static/src/js/user_menu.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import {_t} from "@web/core/l10n/translation";
import {markup} from "@odoo/owl";
import {registry} from "@web/core/registry";
import {session} from "@web/session";
import {markup} from "@odoo/owl";

export function impersonateLoginItem(env) {
return {
Expand Down
4 changes: 3 additions & 1 deletion impersonate_login/tests/test_impersonate_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class TestImpersonateLogin(HttpCase):
def setUpClass(cls):
super().setUpClass()
cls.demo_login = "impersonate_demo"
cls.demo_password = "demo"
# Strong enough for password_security, which lands in the same
# database on the CI and enforces its policy on every user.
cls.demo_password = "Demo!2345"
# Admin always exists; ensure it can impersonate and has a known password
cls.admin_user = cls.env.ref("base.user_admin")
# Make sure admin can use the feature (group check in session info)
Expand Down
139 changes: 139 additions & 0 deletions password_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Password Security
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:08e5a49da633f1b1636ce4877debefb01bb6adda8d4f42ba59bf6b0f58c4cc63
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/19.0/password_security
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-19-0/server-auth-19-0-password_security
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows admin to set company-level password security
requirements and enforces them on the user.

It contains features such as

- Password expiration days
- Password length requirement
- Password minimum number of lowercase letters
- Password minimum number of uppercase letters
- Password minimum number of numbers
- Password minimum number of special characters

**Table of contents**

.. contents::
:local:

Configuration
=============

Navigate to General Settings under Configuration Scroll down to the
``Password Policy`` section Set the policies to your liking.

Password complexity requirements will be enforced upon next password
change for any user in that company.

**Settings & Defaults**

These are defined at the company level:

[TABLE]

Usage
=====

Configure using above instructions for each company that should have
password security mandates.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20password_security%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* LasLabs
* Onestein
* Kaushal Prajapati
* Tecnativa
* initOS GmbH
* Omar Nasr

Contributors
------------

- James Foster <jfoster@laslabs.com>

- Dave Lasley <dave@laslabs.com>

- Kaushal Prajapati <kbprajapati@live.com>

- Petar Najman <petar.najman@modoolar.com>

- Shepilov Vladislav <shepilov.v@protonmail.com>

- Florian Kantelberg <florian.kantelberg@initos.com>

- Carlos Jimeno <carlos.jimeno@bt-group.com>

- Dhara Solanki <dhara.solanki@initos.com>

- `Open Source Integrators <https://opensourceintegrators.com>`__

- Chandresh Thakkar <cthakkar@opensourceintegrators.com>
- Daniel Reis <dreis@opensourceintegrators.com>

- `Onestein <https://www.onestein.nl>`__:

- Andrea Stirpe <a.stirpe@onestein.nl>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/19.0/password_security>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions password_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from .post_install import init_config_parameters
from . import controllers, models
34 changes: 34 additions & 0 deletions password_security/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2015 LasLabs Inc.
# Copyright 2018 Modoolar <info@modoolar.com>.
# Copyright 2019 initOS GmbH
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Password Security",
"summary": "Allow admin to set password security requirements.",
"version": "19.0.1.0.0",
"author": "LasLabs, "
"Onestein, "
"Kaushal Prajapati, "
"Tecnativa, "
"initOS GmbH, "
"Omar Nasr, "
"Odoo Community Association (OCA)",
"category": "Base",
"depends": [
"auth_signup",
"auth_password_policy_signup",
"auth_totp",
],
"website": "https://github.com/OCA/server-auth",
"license": "LGPL-3",
"data": [
"views/res_config_settings_views.xml",
"security/ir.model.access.csv",
"security/res_users_pass_history.xml",
],
"demo": [
"demo/res_users.xml",
],
"post_init_hook": "init_config_parameters",
"installable": True,
}
5 changes: 5 additions & 0 deletions password_security/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import main
from . import home
28 changes: 28 additions & 0 deletions password_security/controllers/home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2022 brain-tec AG (https://bt-group.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import http
from odoo.http import request

from odoo.addons.auth_totp.controllers.home import Home


class PasswordSecurity2FAHome(Home):
@http.route()
def web_totp(self, redirect=None, **kwargs):
already_logged_in = request.session.uid
result = super().web_totp(redirect, **kwargs)
if already_logged_in or not (
request.session.uid and request.env.user._password_has_expired()
):
return result
# My password is expired, kick me out
request.env.user.action_expire_password()
request.session.logout(keep_db=True)
# res.users._login() loaded login_date into this env's cache before
# _update_last_login() created the new res.users.log, so the cached
# value is stale. _generate_signup_token() signs login_date into the
# token, and a stale one is rejected as an invalid signup token.
request.env.user.invalidate_recordset(["login_date", "log_ids"])
redirect = request.env.user.partner_id._get_signup_url()
return request.redirect(redirect)
65 changes: 65 additions & 0 deletions password_security/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).


from werkzeug.exceptions import BadRequest

from odoo import http
from odoo.http import request

from odoo.addons.auth_signup.controllers.main import AuthSignupHome
from odoo.addons.web.controllers.home import ensure_db


class PasswordSecurityHome(AuthSignupHome):
def do_signup(self, qcontext, *args, **kwargs):
password = qcontext.get("password")
user = request.env.user
user._check_password(password)
return super().do_signup(qcontext, *args, **kwargs)

@http.route()
def web_login(self, *args, **kw):
ensure_db()
response = super().web_login(*args, **kw)
if not request.params.get("login_success"):
return response
if not request.env.user:
return response
# Now, I'm an authenticated user
# With 2FA there is a second step, and we would not be completely logged in
if not (request.session.uid and request.env.user._password_has_expired()):
return response
# My password is expired, kick me out
request.env.user.action_expire_password()
request.session.logout(keep_db=True)
# I was kicked out, so set login_success in request params to False
request.params["login_success"] = False
# res.users._login() loaded login_date into this env's cache before
# _update_last_login() created the new res.users.log, so the cached
# value is stale. _generate_signup_token() signs login_date into the
# token, and a stale one is rejected as an invalid signup token.
request.env.user.invalidate_recordset(["login_date", "log_ids"])
redirect = request.env.user.partner_id._get_signup_url()
return request.redirect(redirect)

@http.route()
def web_auth_signup(self, *args, **kw):
"""Try to catch all the possible exceptions not already handled
in the parent method"""

try:
qcontext = self.get_auth_signup_qcontext()
except Exception:
raise BadRequest from None # HTTPError: 400 Client Error: BAD REQUEST

try:
return super().web_auth_signup(*args, **kw)
except Exception as e:
# Here we catch any generic exception since UserError is already
# handled in parent method web_auth_signup()
qcontext["error"] = str(e)
response = request.render("auth_signup.signup", qcontext)
response.headers["X-Frame-Options"] = "SAMEORIGIN"
response.headers["Content-Security-Policy"] = "frame-ancestors 'self'"
return response
9 changes: 9 additions & 0 deletions password_security/demo/res_users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--
Copyright 2016 LasLabs Inc.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
-->
<odoo>
<record id="base.user_root" model="res.users">
<field name="password_write_date" eval="datetime.now()" />
</record>
</odoo>
Loading
Loading