-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX][15.0]auth_saml: password reset when deactivating the config set…
…tings
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,7 +198,7 @@ def test_login_with_saml(self): | |
# User should now be able to log in with the token | ||
self.authenticate(user="[email protected]", password=token) | ||
|
||
def test_disallow_user_password_when_changing_setting(self): | ||
def test_disallow_user_password_when_changing_ir_config_parameter(self): | ||
"""Test that disabling users from having both a password and SAML ids remove | ||
users password.""" | ||
# change the option | ||
|
@@ -336,3 +336,26 @@ def test_redirect_after_login(self): | |
self.base_url() | ||
+ "/web#action=37&model=ir.module.module&view_type=kanban&menu_id=5", | ||
) | ||
|
||
def test_disallow_user_password_when_changing_settings(self): | ||
"""Test that disabling the setting will remove passwords from related users""" | ||
# We activate the settings to allow password login | ||
self.env["res.config.settings"].create( | ||
{ | ||
"allow_saml_uid_and_internal_password": True, | ||
} | ||
).execute() | ||
|
||
# Test the user can login with the password | ||
self.authenticate(user="[email protected]", password="NesTNSte9340D720te>/-A") | ||
|
||
self.env["res.config.settings"].create( | ||
{ | ||
"allow_saml_uid_and_internal_password": False, | ||
} | ||
).execute() | ||
|
||
with self.assertRaises(AccessDenied): | ||
self.authenticate( | ||
user="[email protected]", password="NesTNSte9340D720te>/-A" | ||
) |