Repository navigation
Keep sub-account edits on the owner's accounts and change passwords on the account (2.4.x) - #1008
Open
KrzysztofPajak wants to merge 4 commits into
Open
KrzysztofPajak wants to merge 4 commits into
KrzysztofPajak wants to merge 4 commits into
Conversation
added 2 commits
November 1, 2026 09:01
The edit command relied on the validator for ownership. It now checks it too and changes nothing for a missing, deleted or someone else's account. The edit page redirects for such an id instead of showing an empty form. Hiding the Subaccounts tab only removed the link, so every sub-account action now goes through one check that also honours the setting. The storefront validators now check an e-mail or username in the form it is stored in, within the store of the account being edited. Both are stored trimmed and lowercased, which is what every lookup expects, and a sub-account password is changed only when its e-mail resolves to that same account. With per-store identity one e-mail can belong to several stores, so the customer's own password change now uses the store of the signed-in account.
These callers already hold the account, but the password change looked it up again by e-mail, a value that can change between the two steps and is unique only as far as the application keeps it so. A new overload takes the customer and the existing method now resolves the e-mail and calls it. The sub-account edit no longer needs its check that the e-mail leads back to the account, nor can it skip the remaining edits without telling the owner.
added 2 commits
November 1, 2026 10:28
The password change saved the whole customer, including its e-mail, username, store and active flag. With a copy the caller loaded earlier in the request, that could undo an edit made in the meantime, such as a deactivation. A dedicated update now writes the four password fields in one operation, and still refuses a system account and raises the update event.
2.4.x is a patch line, so plugins built for 2.4.0 must keep working. The new interface members get default bodies that use the existing methods, so an implementation built for an earlier 2.4 release still loads and behaves as it did. The shipped services override them.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
Storefront sub-account management on 2.4.x was missing rules that
developalready has since #991, and customer e-mails and passwords were not handled the same way in every step:HideSubAccountsTabonly removed the link. The sub-account actions stayed available.Solution
develop).ICustomerManagerServicegetsChangePassword(Customer, PasswordFormat, string), which changes the password of that account without an e-mail lookup. The existing method resolves the e-mail and calls it. Both write only the password fields through a newICustomerService.UpdateCustomerPassword, so a copy the caller loaded earlier cannot undo other edits. The sub-account edit and the customer's own password change use the new method.The validator and password parts go beyond #991, so
developgets the same change in #1009.No new resources, settings or migrations. Existing messages are reused because 2.4.x databases do not re-import the language file.
Breaking changes
No rebuild is needed for plugins built for 2.4.0.
ICustomerManagerServiceandICustomerServiceeach have a new member with a default body, so an existing custom implementation keeps loading and uses its existing methods. An implementation ofICustomerManagerServicecompiled against the earlier interface was run against this build to confirm it.One behavior change: with
HideSubAccountsTab = true, which is the fresh-install default, sub-account pages now redirect to My account instead of staying reachable by URL. A store using them that way has to set it tofalse.Testing
Unit tests pass:
Grand.Web.Tests(81),Grand.Business.Customers.Tests(124),Grand.Web.Admin.Tests(1554). The full solution and the steps below were not run.HideSubAccountsTabtofalsein Admin, sign in on the storefront as a registered customer, and add a sub-account.AllowUsersToChangeEmailon, change its e-mail to one with capitals. It is saved lowercased and the sub-account can sign in. An address that is already taken is rejected.HideSubAccountsTabtotrue./account/subaccountsand the add and edit pages redirect to My account.Customer:RegisterCustomersPerStoreon and the same e-mail registered in two stores, change the password in one store. The account in the other store keeps its password.