fix(security): Allow username change in Account section - #74
Open
Ibochkarev wants to merge 2 commits into
Open
Conversation
Enable username editing in the Account profile section with validation. Add unit tests for Profile/Update processor and fix phpcs/PHPUnit CI. Refs modxcms#15575
Require username only when submitted, enforce VARCHAR(100), wrap profile/user saves in a transaction when the username changes, and extend regression coverage (modxcms#15575).
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.
Что сделано
Делает поле username редактируемым в Security → Profile → Account (
textfield, макс 100 символов).Security/Profile/Updateвалидирует формат и уникальность (те же правила символов, что у user admin), пишет значение вmodUserи возвращаетusernameв payload успеха.Username валидируется только когда запрос включает это свойство, поэтому старые клиенты, опускающие его, всё ещё обновляют профиль. При смене username сохранение профиля и пользователя идут в DB-транзакции.
Зачем нужно
Username в Account показывался read-only после modxcms#15539, поэтому пользователи не могли переименовать себя из Profile (modxcms#15575).
Как проверить
<>;'\"()) / занятое имя → ошибки поля.phpunit --filter 'Processors\\Security\\Profile\\UpdateTest'Связанные
Refs modxcms#15575
Оригинал: modxcms#16853