Skip to content

User name guard and prefix - #21

Merged
hololee merged 7 commits into
mainfrom
user-name-guard-and-prefix
Feb 17, 2026
Merged

hololee merged 7 commits into
mainfrom
user-name-guard-and-prefix

Conversation

@hololee

@hololee hololee commented Feb 17, 2026

Copy link
Copy Markdown
Owner

Summary

This PR introduces browser-scoped user identity (User Name) and enforces it across navigation and environment
creation.

Key outcomes:

  • Added User Name management in Settings > General
  • Restricted access to non-exempt pages when User Name is missing/invalid
  • Enforced environment name prefix on provisioning: {userName}-{environmentName}
  • Added localized copy (en/ko) for all user-name and guard flows
  • Extended shared Modal to support custom button labels

Scope

1) Browser-scoped user identity utilities

  • Added frontend/src/utils/userIdentity.ts
  • Includes:
    • normalizeUserName
    • validateUserName (empty, too_long, invalid_format, ok)
    • getStoredUserName, setStoredUserName, clearStoredUserName
    • buildPrefixedEnvironmentName (prevents duplicate prefix)

2) Settings: User Name management

  • Updated frontend/src/pages/Settings.tsx
  • Added User Name field directly under Application Name
  • Added validation/error/success status messages
  • Split Application Name and User Name into separate forms so Enter submits the intended section only

3) Route guard for missing User Name

  • Added frontend/src/components/UserNameGuard.tsx
  • Applied guard in frontend/src/App.tsx to:
    • /provisioning
    • /terminal
    • /templates
  • Exempt pages:
    • / (Dashboard)
    • /settings
  • Guard behavior:
    • Shows existing shared Modal
    • Redirects user to Settings

4) Provisioning name prefix enforcement

  • Updated frontend/src/pages/Provisioning.tsx
  • At submit time, environment name is always transformed to:
    • {userName}-{name}
  • Prevents double prefix if already prefixed
  • Blocks submit if User Name is missing/invalid
  • Added final name preview text in UI

5) i18n updates

  • Updated:
    • frontend/src/i18n/locales/en/common.ts
    • frontend/src/i18n/locales/ko/common.ts
  • Added localized keys for:
    • guard title/message/action
    • settings user-name labels/placeholders
    • settings validation/success/failure feedback
    • provisioning prefix preview + user-name-required error

6) Modal enhancement

  • Updated frontend/src/components/Modal.tsx
  • Added optional props:
    • confirmText
    • cancelText
  • Backward-compatible defaults preserved

Validation

  • npm --prefix frontend run lint passed
  • npm --prefix frontend run build passed
  • PYTHONPATH=backend pytest -q backend/tests passed (36 passed)
  • docker compose up --build -d executed successfully

Notes

  • User Name is intentionally browser-scoped (localStorage) and not server-global.
  • App Name/Favicon remain server-side settings (global across clients).

@hololee hololee self-assigned this Feb 17, 2026
@hololee
hololee merged commit 077f05b into main Feb 17, 2026
1 check passed
@hololee
hololee deleted the user-name-guard-and-prefix branch February 17, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant