Skip to content

auth.login_path: let a site serve its own login page #159

Closed

Description

@zumbrunn

Problem

The content-gating docs described a loginPath option (custom login page route). It never existed: /auth/login is hard-coded in the gating redirect (src/auth/gating.ts), the mounted routes (src/auth/mount.ts), the password-login error redirect (src/auth/password-login.ts) and the login form. The docs are corrected in duneorg/dune-docs#30. A site with its own login or join page (e.g. a members site with a branded entry page) has no way to send visitors there.

Proposal

site.yaml:

auth:
  login_path: /join   # default: /auth/login
  • Gating redirects (page gate, mediaDenialResponse, anything else that builds /auth/login?next=) go to login_path with ?next=.
  • GET /auth/login redirects to login_path when it is set, preserving the query (next, error). Decided: it redirects rather than still rendering, so there is one login page.
  • Everything else under /auth/* stays mounted: POST /auth/login, OAuth callbacks, magic-link verification, logout. The custom page posts to them.
  • Failures that redirect back to the login page (?error=invalid etc.) go to login_path.
  • The site provides the page at login_path itself (a normal Dune page or TSX route).

Edge cases to settle in the PR

Related: #157, #158.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions