Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
47e0179
[9.0][ADD] Password Security Settings (#531)
lasley Sep 29, 2016
10c8a89
[MIG] Make modules uninstallable
pedrobaeza Oct 6, 2016
fb39e68
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
11d324b
[MIG] password_security: Migrate to v10
lasley Oct 20, 2016
70b8055
[FIX] password_security: Validate admin pass
lasley Dec 23, 2016
4c4e956
[FIX] password_security: Fix history rule
lasley Jan 9, 2017
2fcd50c
Improve UX password_match_message()
astirpe May 5, 2017
35edefb
[FIX] password_security: Fix password stored and token to reset passw…
moylop260 Jun 20, 2017
bae0dab
[FIX] password_security: Force password reset
obulkin Sep 18, 2017
e79c3d9
[MIG]password security
smurf-U Oct 11, 2017
2a346f6
[IMP]change request
smurf-U Oct 27, 2017
edb16be
[IMP]Underscore is a special character #1077
StefanRijnhart Nov 29, 2017
814d192
[FIX] password_security: Default last write date #1084
lasley Dec 4, 2017
5b359b9
[FIX] UTF-8 coding is not necessary
max3903 Mar 28, 2018
ec7f5de
[MIG] auth_totp_password_security: Migration to 11.0
MiquelRForgeFlow May 14, 2018
92ae059
[I18N] password_security: Translate to Spanish all translatable terms
luisg123v Jun 18, 2018
61cceed
[FIX] password_security: Error 500 when login with bad password (#27)
yajo Jun 19, 2018
19689e0
[FIX] password_security: Allow mini-admin to create users (#31)
yajo Jun 22, 2018
5a1c928
[FIX] password_security: Make tests pass if website is installed
yajo Nov 27, 2018
fedb098
[UPD] Update password_security.pot
oca-travis Dec 12, 2018
eff2966
[MIG] password_security: Migration to 12.0
shepilov-vladislav Apr 12, 2019
434f03d
[FIX] password_security: correct readme fragments
sbidoul May 11, 2019
221dd0b
[UPD] README.rst
OCA-git-bot May 11, 2019
cc1726a
[FIX] 12.0 `password_security` - Reset Password
amkarthik Jul 18, 2019
4648cdd
[FIX] 12.0 `password_security` - Reset Password
amkarthik Jul 22, 2019
4767af6
[UPD] README.rst
OCA-git-bot Jul 29, 2019
bfb3486
Add zxcvbn to password security
fkantelberg Sep 1, 2019
3e3e80d
Force add zxcvbn js lib
fkantelberg Sep 7, 2019
3879412
[UPD] README.rst
OCA-git-bot Oct 1, 2019
6cbfd48
Translated using Weblate (Croatian)
badbole Nov 13, 2019
abbad29
[FIX] [12.0] password_security - redirection fails when password_secu…
amkarthik Jul 23, 2019
f39be95
password_security 12.0.1.1.2
OCA-git-bot Mar 30, 2020
f2595e6
making password_security compatible with odoo 13.0
Moro-Code Apr 23, 2020
d2e04a0
add external dependency
Moro-Code Apr 27, 2020
354ad32
Translated using Weblate (Portuguese)
pedrocs-exo Oct 12, 2020
29baa75
Translated using Weblate (Portuguese)
pedrocs-exo Oct 13, 2020
a1c834b
[UPD] Update password_security.pot
oca-travis Nov 30, 2020
f3ed576
Update translation files
oca-transbot Nov 30, 2020
d333ac0
Reformat password_security to match tests
llacroix Dec 10, 2020
9e5ae02
[UPD] Update password_security.pot
oca-travis Feb 2, 2021
722cdff
[UPD] README.rst
OCA-git-bot Feb 2, 2021
e6ddb7d
[MIG] Migrated the module in v14.
Chandresh-SerpentCS Feb 10, 2021
ae46d60
[IMP] Improved the code.
Chandresh-SerpentCS Feb 22, 2021
e952ec4
[FIX] password_policy: error messages properly presented to the user
dreispt Mar 25, 2021
17de63d
[UPD] Update password_security.pot
oca-travis Mar 25, 2021
3793e36
[UPD] README.rst
OCA-git-bot Mar 25, 2021
29f5baf
Translated using Weblate (Finnish)
jarmokortetjarvi Nov 17, 2021
e513e56
Translated using Weblate (Swedish)
beremavertel Feb 9, 2022
dade4ed
Translated using Weblate (Swedish)
beremavertel Feb 10, 2022
7ec9eda
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 31, 2022
1cc0fcb
[IMP] password_security: black, isort, prettier
dsolanki-initos Jan 9, 2023
6a84f8e
[MIG] password_security: Migration to 15.0
dsolanki-initos Jan 9, 2023
c1e4967
[UPD] Update password_security.pot
Feb 3, 2023
8d3f861
[UPD] README.rst
OCA-git-bot Feb 3, 2023
4fb6a7d
[16.0][MIG] password_security
astirpe Feb 20, 2023
c48727a
[MIG] password_security: migration of password_length
astirpe Mar 10, 2023
7f48ae6
[MIG] password_security: explicit super()
astirpe Mar 10, 2023
2ebf6b3
[FIX] password_security: access rights for portal user with replacement
astirpe May 31, 2023
c0918a7
[FIX] password_security: compatibility with 2FA
astirpe Jun 15, 2023
6fadce1
[FIX] password_security: fix _order of res.users.pass.history
astirpe Jul 25, 2023
343dadb
[FIX] password_security: fix test on missing partner given for new user
astirpe Jul 25, 2023
17be36a
[FIX] password_security: adapt test to auth_signup_verify_email
astirpe Jul 25, 2023
e767415
[IMP] password_security: config settings refactoring
astirpe Jul 25, 2023
d1c6a97
[IMP] password_security: remove password_estimate
astirpe Jul 27, 2023
34d3f10
Update password_security/views/res_config_settings_views.xml
astirpe Aug 7, 2023
aa21235
[UPD] Update password_security.pot
Oct 10, 2023
ef3af70
[BOT] post-merge updates
OCA-git-bot Oct 10, 2023
11ea91c
Update translation files
weblate Oct 10, 2023
f53b340
Translated using Weblate (Italian)
mymage Oct 13, 2023
0c550b5
Translated using Weblate (Italian)
francesco-ooops Oct 13, 2023
a84d6d2
Translated using Weblate (Spanish)
Ivorra78 Oct 15, 2023
0b29f5f
Translated using Weblate (Italian)
mymage Jan 4, 2024
461c284
[IMP] password_security: pre-commit stuff
Jan 31, 2024
2e04219
[MIG] password_security: Migration to 17.0
Jan 31, 2024
4ceb8b3
[IMP] password_security: use ir.config_parameter
alexis-via Nov 16, 2024
efb6c10
[IMP] password_security: pre-commit auto fixes
IsabelAForgeFlow Mar 10, 2025
36290bb
[MIG] password_security: Migration to 18.0
IsabelAForgeFlow Mar 10, 2025
768eb79
[FIX] password_security: password expiration 2FA
Jan 21, 2022
148c6e5
[FIX] password_security: test separately
LauraCForgeFlow Mar 17, 2025
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
3 changes: 2 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ odoo_test_flavor: Both
odoo_version: 18.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
rebel_module_groups:
- password_security
repo_description: server-auth
repo_name: server-auth
repo_slug: server-auth
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ jobs:
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest
include: "password_security"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest
include: "password_security"
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest
exclude: "password_security"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest
exclude: "password_security"
name: test with OCB
makepot: "true"
services:
Expand All @@ -51,6 +60,8 @@ jobs:
- 5432:5432
env:
OCA_ENABLE_CHECKLOG_ODOO: "1"
INCLUDE: "${{ matrix.include }}"
EXCLUDE: "${{ matrix.exclude }}"
steps:
- uses: actions/checkout@v4
with:
Expand Down
16 changes: 7 additions & 9 deletions auth_oidc/tests/test_auth_oidc_auth_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,13 @@ def test_login_without_any_key(self):
keys=[],
)

with (
self.assertRaises(AccessDenied),
MockRequest(self.env),
self.assertLogs(level=logging.ERROR) as logs,
):
self.env["res.users"].auth_oauth(
self.provider_rec.id,
{"state": json.dumps({})},
)
with self.assertRaises(AccessDenied):
with MockRequest(self.env):
with self.assertLogs(level=logging.ERROR) as logs:
self.env["res.users"].auth_oauth(
self.provider_rec.id,
{"state": json.dumps({})},
)
self.assertEqual(len(logs.records), 1)
self.assertEqual(logs.records[0].levelno, logging.ERROR)
self.assertEqual(
Expand Down
135 changes: 135 additions & 0 deletions password_security/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
=================
Password Security
=================

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

.. |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/licence-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/18.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-18-0/server-auth-18-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=18.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:%2018.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/18.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": "18.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
23 changes: 23 additions & 0 deletions password_security/controllers/home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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)

Check warning on line 14 in password_security/controllers/home.py

View check run for this annotation

Codecov / codecov/patch

password_security/controllers/home.py#L13-L14

Added lines #L13 - L14 were not covered by tests
if already_logged_in or not (
request.session.uid and request.env.user._password_has_expired()
):
return result

Check warning on line 18 in password_security/controllers/home.py

View check run for this annotation

Codecov / codecov/patch

password_security/controllers/home.py#L18

Added line #L18 was not covered by tests
# My password is expired, kick me out
request.env.user.action_expire_password()
request.session.logout(keep_db=True)
redirect = request.env.user.partner_id._get_signup_url()
return request.redirect(redirect)

Check warning on line 23 in password_security/controllers/home.py

View check run for this annotation

Codecov / codecov/patch

password_security/controllers/home.py#L20-L23

Added lines #L20 - L23 were not covered by tests
63 changes: 63 additions & 0 deletions password_security/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

import logging

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

_logger = logging.getLogger(__name__)


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

@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

Check warning on line 31 in password_security/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

password_security/controllers/main.py#L31

Added line #L31 was not covered by tests
# 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
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