Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 8 additions & 7 deletions auth_saml/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@ def _set_password_blank(self):
"""Set the password to a value that prohibits logging."""
# Use SQL to blank the password to avoid sending security messages (done in
# mail module) to end users.
_logger.debug("Removing password from %s user(s)", len(self.ids))
# similar to what Odoo does in Users._set_encrypted_password
self.env.cr.execute(
"UPDATE res_users SET password = NULL WHERE id IN %s",
(tuple(self.ids),),
)
self.invalidate_recordset(fnames=["password"])
if self: # no users, nothing to do.
_logger.debug("Removing password from %s user(s)", len(self.ids))
# similar to what Odoo does in Users._set_encrypted_password
self.env.cr.execute(
"UPDATE res_users SET password = NULL WHERE id IN %s",
(tuple(self.ids),),
)
self.invalidate_recordset(fnames=["password"])

def allow_saml_and_password_changed(self):
"""Called after the parameter is changed."""
Expand Down
5 changes: 4 additions & 1 deletion auth_saml/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from . import fake_idp, test_pysaml, test_models_saml_attribute_mapping
from . import fake_idp
from . import test_pysaml
from . import test_models_saml_attribute_mapping
from . import test_param_change
10 changes: 10 additions & 0 deletions auth_saml/tests/test_param_change.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo.tests.common import TransactionCase


class TestParamChange(TransactionCase):
def test_set_param(self):
"""Changing the parameter should go through without error"""
self.env["ir.config_parameter"].set_param(
"auth_saml.allow_saml_uid_and_internal_password",
False,
)