media-backend/media-webui: proxy admin login identity to AuthGuard
The media-collection family (KioskDisplay, MediaAnalyzer, MediaTools, MediaViewer, MediaServant, ModerationHub, ProjectConfigurator) shared one standalone local single-admin auth implementation with no AuthGuard connection, including its own local "reset admin account" flow - the same situation the recently-migrated forks were in. Proxies every /auth/... and /api/auth/... admin-identity operation to AuthGuard via the existing Go authclient, forwards its Set-Cookie, keeps a local one-time setup-claim flag (reusing the existing settings table, no schema change), and drops the local reset flow entirely (only AuthGuard's own web UI keeps one now). Deliberately left untouched: the separate "moderator manages platform users" surface (admin_storage.go's mountModeratorRoutes) and the independent loginRequired/auth_required public-install toggle, both of which are unrelated to this service's own admin login identity despite superficially sharing code style/table with the migrated pieces.
This commit is contained in:
1 parent
de9b599232
commit
9589d07baf
7 files changed
+1055
-560
No files matched your search
@@ -139,13 +139,6 @@
|
||||
auth = { ...auth, user: data.user, setupRequired: false, loading: false, error: null }
|
||||
}
|
||||
|
||||
const requestReset = () => post('/auth/reset/request')
|
||||
|
||||
async function confirmReset(code: string) {
|
||||
await post('/auth/reset/confirm', { code })
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
try {
|
||||
await post('/auth/logout')
|
||||
@@ -199,8 +192,6 @@
|
||||
error={auth.error || ''}
|
||||
onLogin={login}
|
||||
onSetup={setup}
|
||||
onRequestReset={requestReset}
|
||||
onConfirmReset={confirmReset}
|
||||
/>
|
||||
{:else}
|
||||
<div class="sc-root sc-app-shell min-h-screen bg-bg text-fg mediacollection-shell">
|
||||
|
||||
@@ -1,43 +1,22 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
AuthPage as SharedAuthPage,
|
||||
type AuthLoginInput,
|
||||
type AuthResetConfirm,
|
||||
type AuthResetRequest,
|
||||
type AuthSetupInput,
|
||||
} from '@gabriel20xx/web-ui'
|
||||
import { AuthPage as SharedAuthPage, type AuthLoginInput, type AuthSetupInput } from '@gabriel20xx/web-ui'
|
||||
import type { AppConfig } from '$lib/types'
|
||||
|
||||
let {
|
||||
app,
|
||||
error = '',
|
||||
loading = false,
|
||||
onConfirmReset,
|
||||
onLogin,
|
||||
onRequestReset,
|
||||
onSetup,
|
||||
setupRequired,
|
||||
}: {
|
||||
app: AppConfig
|
||||
error?: string
|
||||
loading?: boolean
|
||||
onConfirmReset: AuthResetConfirm
|
||||
onLogin: (input: AuthLoginInput) => void | Promise<void>
|
||||
onRequestReset: AuthResetRequest
|
||||
onSetup: (input: AuthSetupInput) => void | Promise<void>
|
||||
setupRequired: boolean
|
||||
} = $props()
|
||||
</script>
|
||||
|
||||
<SharedAuthPage
|
||||
brand={app.name}
|
||||
tagline={app.eyebrow}
|
||||
{setupRequired}
|
||||
{loading}
|
||||
{error}
|
||||
showTotp
|
||||
{onLogin}
|
||||
{onSetup}
|
||||
{onRequestReset}
|
||||
{onConfirmReset}
|
||||
/>
|
||||
<SharedAuthPage brand={app.name} tagline={app.eyebrow} {setupRequired} {loading} {error} showTotp {onLogin} {onSetup} />
|
||||
Reference in new issue
Block a user