feat(web): add configurable login message

Merged
BR
2mo ago
+500-12

Fixes SOU-2272

Admins can now publish access instructions and registration links above the sign-in and sign-up forms. Owners edit a Markdown message under Settings → Security, below SCIM, with Write and Preview tabs; clearing it hides the message.

  • Store the optional message on the organization with an owner-only update action and a 5,000-character limit.
  • Render Markdown formatting and links while excluding raw HTML, images, and unsafe URLs. Messages taller than 120px collapse with an ellipsis and Show more / Show less controls, including in the preview.
  • Tighten login form spacing and place authentication errors below the submit controls with a subtle background.

Validation: 32 focused tests pass, covering authorization, validation, persistence, editing, Markdown rendering, and expansion behavior. ESLint passes for all changed TypeScript files. Type checking reports six existing generated .next/types errors in unrelated settings routes. The migration was applied successfully to the local development database.


[!NOTE]
Medium Risk
Introduces admin-editable content on unauthenticated login/signup pages and a schema migration; rendering is constrained but any misconfiguration could still mislead users before authentication.

Overview
Adds an optional org-level login message that owners configure under Settings → Security and that appears above sign-in options on /login and /signup.

The message is stored as Org.loginMessage (new DB column + migration), updated via an owner-only setLoginMessage server action with a 5,000-character limit and whitespace-only values cleared to null. The settings UI uses Write/Preview tabs and reuses the same LoginMessage renderer as the auth pages.

On the auth UI, LoginMessage renders restricted Markdown (no raw HTML/images; links open in a new tab; unsafe javascript: links are not linked). Tall content collapses with Show more/less, including keyboard focus behavior. LoginForm layout is adjusted so the message sits above auth methods and auth errors appear below the selector.

Reviewed by Cursor Bugbot for commit e8f976d61c457de6a83e9a2fd4e1905c1e2a26b2. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes SOU-2272 by letting organizations show a Markdown message above the sign-in and sign-up forms. Owners set or clear it under Settings → Security; an empty message hides it.

New Features

  • Persists the optional message on the organization with an owner-only update action and a 5,000-character limit.
  • Renders Markdown formatting and links while blocking raw HTML, images, and unsafe URLs; long messages collapse with Show more/Show less.
  • Moves authentication errors below the sign-in controls and tightens card spacing.

Migration

  • Adds a nullable loginMessage column to the Org table; no data backfill is required.

Summary by CodeRabbit

  • New Features

    • Admins can configure a Markdown message for sign-in and sign-up pages.
    • Messages support safe formatting, links, character limits, previews, and expandable display.
    • Added controls in Security Settings to create, edit, preview, and remove the message.
  • Bug Fixes

    • Improved authentication-page spacing and error-message accessibility.
  • Tests

    • Added coverage for message editing, validation, rendering, security, and authentication flows.