forked from odoo/odoo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] auth_signup, website: make reset password multi website friendly
The "reset password" feature does not take into account multi-website. steps to reproduce: - create a website A - uncheck 'Shared Customer Accounts' on website A - create a portal user [email protected] on website A - create a website B - uncheck 'Shared Customer Accounts' on website B - create a portal user [email protected] on website B - reset password for [email protected] on any website before this commit: An error is raised "No account found for this login" (which is false, actually 2 accounts are found) after this commit: Only the user linked to the current website is properly selected opw-3551540 closes odoo#141925 X-original-commit: 4fd3b7a Signed-off-by: Romain Derie (rde) <[email protected]>
- Loading branch information
Showing
5 changed files
with
44 additions
and
3 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
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 |
---|---|---|
|
@@ -75,3 +75,26 @@ def test_02_multi_user_login(self): | |
# The most specific user should be selected | ||
self.authenticate("[email protected]", "[email protected]") | ||
self.assertEqual(self.session["uid"], user2.id) | ||
|
||
def test_multi_website_reset_password_user_specific_user_account(self): | ||
# Create same user on different websites with 'Specific User Account' | ||
# option enabled and then reset password. Only the user from the | ||
# current website should be reset. | ||
website_1, website_2 = self.env['website'].create([ | ||
{'name': 'Website 1', 'specific_user_account': True}, | ||
{'name': 'Website 2', 'specific_user_account': True}, | ||
]) | ||
|
||
login = '[email protected]' # same login for both users | ||
user_website_1, user_website_2 = self.env['res.users'].with_context(no_reset_password=True).create([ | ||
{'website_id': website_1.id, 'login': login, 'email': login, 'name': login}, | ||
{'website_id': website_2.id, 'login': login, 'email': login, 'name': login}, | ||
]) | ||
|
||
self.assertFalse(user_website_1.signup_valid) | ||
self.assertFalse(user_website_2.signup_valid) | ||
|
||
self.env['res.users'].with_context(website_id=website_1.id).reset_password(login) | ||
|
||
self.assertTrue(user_website_1.signup_valid) | ||
self.assertFalse(user_website_2.signup_valid) |
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