Phase 14c-1: editor auth on iManager 2.0 (login/logout, CSRF)#23
Merged
Conversation
The /editor/ admin shell now boots through a brand-new
Scriptor\Boot\Editor\ namespace on the iManager 2.0 container — no
calls into the legacy Scriptor::build() / editor/core/ path on the
public auth flow.
New code:
- Editor\Editor surface for theme/template.php (siteUrl,
themeUrl, version, csrf, msgs[], pageTitle,
pageContent, breadcrumbs, jsConfig, i18n,
sanitizer, urlSegments, session). Loads the
legacy lang/<lang>.php files verbatim.
- Editor\EditorRouter routes /editor/<module>/<action>; auth is
live, every other slug returns a typed
"coming back in 14c-N" placeholder so the
branch stays end-to-end testable until the
remaining modules ship.
- Editor\UserRepository thin lookup over CategoryRepository +
ItemRepository for the Users category.
- Editor\Auth\AuthModule login form + login/logout handlers on
Imanager\Http\Csrf, Request, SessionStore.
Verifies bcrypt hashes via password_verify();
accepts both the new plain-string password
field and the migrated 1.x
{__class, password, salt} wrapper.
- Editor\Auth\LoginAttempts session-scoped IP lockout
(maxFailedAccessAttempts /
accessLockoutDuration from scriptor-config).
Bootstrap:
- ImanagerBootstrap registers Imanager\Http\NativeSessionStore (in
the "scriptor" namespace) and Imanager\Http\Csrf (maxTokens=10).
Editor entry / theme:
- editor/index.php: 1-line legacy include replaced by an explicit
require boot.php + new Editor + EditorRouter.
- editor/theme/{template,header,summary}.php trimmed: drop the 1.x
`IS_IM` define, drop \Scriptor\Core\Scriptor::VERSION, switch the
profile/sidebar menus to the new $editor surface (isLoggedIn(),
urlSegments, csrfQueryString()).
CSRF: every login POST and logout GET must carry a token; failures
flash a translated `error_csrf_token_mismatch` error.
Manual smoke (PHP built-in server):
GET /editor/auth/ → 200 login form (CSRF token len=64)
POST /editor/auth/ wrong creds → 200 error msg, attempts++
POST /editor/auth/ admin/<default> → 302 → /editor/
GET /editor/ → 200 dashboard, sidebar
GET /editor/pages → 200 placeholder (14c-2)
GET /editor/auth/logout/?tokenName=&... → 302 → /editor/auth/
GET /editor/ → 200 login form (logged out)
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.
Summary
The /editor/ admin shell now boots through a brand-new
Scriptor\Boot\Editor\namespace on the iManager 2.0 container —no calls into the legacy
Scriptor::build()/editor/core/pathon the public auth flow.
version, csrf, msgs, pageTitle, pageContent, breadcrumbs, jsConfig,
i18n, sanitizer, urlSegments, session). Loads legacy
lang/<lang>.phpverbatim.
/editor/<module>/<action>; auth islive, every other slug returns a typed "coming back in 14c-N"
placeholder so the branch stays end-to-end testable until the
remaining modules ship.
ItemRepository for the Users category.
Imanager\Http\Csrf, Request, SessionStore. Verifies bcrypt hashesvia
password_verify(); accepts both the new plain-string passwordfield and the migrated 1.x
{__class, password, salt}wrapper.(
maxFailedAccessAttempts/accessLockoutDurationfromscriptor-config).
Bootstrap:
ImanagerBootstrapregistersNativeSessionStore(namespacedscriptor) andCsrf(maxTokens=10).Editor entry / theme:
editor/index.php's 1-line legacy includereplaced by an explicit
require boot.php+ new Editor + EditorRouter.editor/theme/{template,header,summary}.phptrimmed: drop the 1.xIS_IMdefine, drop\Scriptor\Core\Scriptor::VERSION, switch theprofile/sidebar menus to the new
$editorsurface (isLoggedIn(),urlSegments,csrfQueryString()).CSRF: every login POST and logout GET must carry a token; failures
flash a translated
error_csrf_token_mismatcherror.Test plan
GET /editor/auth/→ 200, login form, CSRF token len=64POST /editor/auth/wrong creds → 200, error msg, attempts++POST /editor/auth/admin /gT5nLazzyBob→ 302 → /editor/GET /editor/(auth) → 200 dashboard with sidebarGET /editor/pages→ 200 placeholder (14c-2)GET /editor/auth/logout/?tokenName=…&tokenValue=…→ 302 → /editor/auth/GET /editor/after logout → 200 login form