-
-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX auth_saml: password reset when deactivating the config settings
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -273,3 +273,24 @@ def test_disallow_user_admin_can_have_password(self): | |
).value = "False" | ||
# Test base.user_admin exception | ||
self.env.ref("base.user_admin").password = "nNRST4j*->sEatNGg._!" | ||
|
||
def test_config_setting_deactivate_password(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="Lu,ums-7vRU>0i]=YDLa") | ||
|
||
self.env["res.config.settings"].create( | ||
{ | ||
"allow_saml_uid_and_internal_password": False, | ||
} | ||
).execute() | ||
|
||
with self.assertRaises(AccessDenied): | ||
self.authenticate(user="[email protected]", password="Lu,ums-7vRU>0i]=YDLa") |