Phase 14c-3: editor profile module on iManager 2.0#26
Merged
Conversation
Plan §6 lists a separate `users` (CRUD) sub-phase at 14c-3 and
`profile` at 14c-6, but legacy Scriptor only ships `profile` (the
logged-in user edits their own record). Per Plan §9 (functional
parity, no new features) we collapse the two slots: this PR is the
profile rewrite, and 14c-6 drops out of the schedule. Master plan
table needs the matching update on the iManager docs side.
New Editor\Profile\ProfileModule covers editor/modules/profile/profile.php:
- GET /editor/profile/ → 302 to /edit/?profile=<currentUserId>
- GET /editor/profile/edit/ render the form (name, email, password,
password_confirm + CSRF token)
- POST action=save-profile validate + persist + flash + redirect
Validation:
- username + email required (same legacy "profile_incomplete" message)
- new password optional; if set, must be ≥6 chars and equal to confirm
- email goes through Sanitizer::email; rejects invalid syntax
- username uniqueness preflight via UserRepository::nameTaken(except)
- CSRF token (`profile`) required when protectCSRF is on
Password handling preserves the migrated 1.x PasswordFieldValue
wrapper shape (`{__class, password, salt}`): when the existing field
value is a wrapper array we update its `password` key in place;
otherwise we write a plain bcrypt hash so the modern PasswordFieldType
reads it directly. Auth still recognises both shapes (added in 14c-1),
so a password change here keeps the legacy wrapper intact and stays
compatible with any unmigrated tooling.
UserRepository gained:
- nameTaken(name, exceptId) — uniqueness preflight
- save(Item) — wraps ItemRepository::save with category check
EditorRouter routes /editor/profile* to ProfileModule and removes both
the `profile` and `users` placeholder entries.
Manual smoke (PHP built-in server):
GET /editor/profile → 302 → /editor/profile/edit/?profile=9
GET /editor/profile/ → 302 → same
GET /editor/profile/edit/ → 200, form pre-filled (admin / migrated email)
POST update email → 302; DB shows new email
POST password change → 302; logout + retry
old password → 200 (login form, rejected)
new password → 302 → /editor/ (accepted)
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.
Plan §6 lists a separate
users(CRUD) sub-phase at 14c-3 andprofileat 14c-6, but legacy Scriptor only shipsprofile(the logged-in user edits their own record). Per Plan §9 (functional parity, no new features) we collapse the two slots: this PR is the profile rewrite, and 14c-6 drops out of the schedule. Master plan table needs the matching update on the iManager docs side.New Editor\Profile\ProfileModule covers editor/modules/profile/profile.php:
password_confirm + CSRF token)
Validation:
profile) required when protectCSRF is onPassword handling preserves the migrated 1.x PasswordFieldValue wrapper shape (
{__class, password, salt}): when the existing field value is a wrapper array we update itspasswordkey in place; otherwise we write a plain bcrypt hash so the modern PasswordFieldType reads it directly. Auth still recognises both shapes (added in 14c-1), so a password change here keeps the legacy wrapper intact and stays compatible with any unmigrated tooling.UserRepository gained:
EditorRouter routes /editor/profile* to ProfileModule and removes both the
profileandusersplaceholder entries.Manual smoke (PHP built-in server):
GET /editor/profile → 302 → /editor/profile/edit/?profile=9
GET /editor/profile/ → 302 → same
GET /editor/profile/edit/ → 200, form pre-filled (admin / migrated email)
POST update email → 302; DB shows new email
POST password change → 302; logout + retry
old password → 200 (login form, rejected)
new password → 302 → /editor/ (accepted)