You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(core): rewrite ResponseFactory for redirect-only OAuth flow
Replace the HtmlResponse popup approach with a proper RedirectResponse
flow throughout Forum\Auth\ResponseFactory:
- Logged-in users: redirect to returnTo with remember-me cookie set.
- Email-match users: auto-link provider then same redirect.
- New users: redirect to returnTo with _flarum_auth=<token> appended so
the frontend can open the SignUpModal without any JS window tricks.
Remove authenticationComplete() from ForumApplication — it existed only
to call window.opener callbacks from the popup flow.
The returnTo parameter must be validated by the caller (AbstractOAuth-
Controller::validateReturnTo) before being passed to make(); this class
trusts it is a safe same-origin path.
Add unit and integration test coverage for Registration, ResponseFactory
and LoginProvider.
BREAKING CHANGE: ResponseFactory::make() now requires a $returnTo string
as the fourth argument, and returns a RedirectResponse instead of an
HtmlResponse. Extensions or custom OAuth controllers that call make()
directly must be updated. authenticationComplete() is removed from
ForumApplication.
* Apply fixes from StyleCI
* fix(tests): fix 3 unit test failures in OAuth-related classes
- Registration::$payload initialised to null to prevent "must not be
accessed before initialization" error on getPayload() when nothing
has been provided.
- ResponseFactoryTest: remove makeLoggedInResponse unit tests that hit
RememberAccessToken::generate() → Eloquent DB connection. The logged-
in redirect path is already covered by the integration test suite;
unit tests now only cover URL construction logic for the registration
response (which needs no DB).
* Apply fixes from StyleCI
* chore(js): yarn format
* feat(core): add RegistrationTokenResource for redirect-based OAuth pre-population
Redirect-based OAuth flows (e.g. fof/oauth) bounce the user back to the forum
with a _flarum_auth query param carrying a RegistrationToken. Previously there
was no way to resolve that token back to username/email/provided fields without
a round-trip through the popup authenticationComplete callback.
- Add GET /api/registration-tokens/{token} — returns username, email, and the
provided[] field list. Provider name, identifier, and payload internals are
NOT exposed. The token acts as its own credential; no auth required.
- Store suggested fields (suggestUsername, suggestEmail) in the token payload
under a 'suggested' key so they survive the redirect.
- Add RegistrationTokenResource to ApiServiceProvider.
- Integration tests: 15 cases covering happy paths, all field combinations,
security (sensitive fields absent), expiry, and rejected write methods.
- ResponseFactory integration test: assert suggested fields land in payload.
* Apply fixes from StyleCI
* feat(core): add POST /api/registration-token endpoint for OAuth sign-up pre-population
Redirect-based OAuth flows return the user to the forum with a
_flarum_auth token in the URL. The frontend needs to resolve that token
to username/email/provided[] before opening the SignUpModal.
Using POST (body: {token}) rather than GET /{token} keeps the token out
of server access logs, browser history, and Referer headers.
- ResolveRegistrationTokenController: accepts {token} in POST body,
returns {username, email, provided[]}. Provider name, identifier, and
payload internals are not exposed. Returns 404 for invalid/expired tokens.
- Route: POST /api/registration-token (name: registration-token)
- CSRF exempt (same pattern as /api/token login endpoint)
- Also stores suggested fields in token payload so they survive the redirect
(ResponseFactory change from previous commit)
- 15 integration tests: happy paths, field combinations, security
(sensitive fields absent), expiry, and rejected HTTP methods
* Apply fixes from StyleCI
* feat(sign-up): add visible labels to all SignUpModal fields
Username, Nickname (when flarum-nicknames is active), Email and Password
fields now display a <label> above the input so they are clearly
distinguishable when pre-filled from an OAuth redirect — previously
placeholder text disappears once a value is present, making Username and
Nickname look identical.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(ResponseFactory): append _flarum_linked param on email-match auto-link
When an OAuth login auto-links a user via email match, the redirect now
includes _flarum_linked={provider} so the frontend can show the
AccountLinkedModal informing the user their accounts have been connected.
* fix: resolve merge conflict markers in ResolveTest.php
* Apply fixes from StyleCI
* fix(test): update email_match test to expect _flarum_linked in redirect URL
* refactor(ResponseFactory): make makeLoggedInResponse/makeRegistrationResponse protected, move _flarum_linked URL-building into make()
Extensions can now override either method to customise the login redirect
or registration handoff without needing to touch _flarum_linked logic.
Clean signature: makeLoggedInResponse(User, string) with no optional params.
Adds regression test asserting returning users do not get _flarum_linked appended.
---------
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments