Repository basics: - CONTRIBUTING.md and CODE_OF_CONDUCT.md (Contributor Covenant 2.1) - SPDX AGPL-3.0-or-later headers on all hand-written sources, checked in CI - golangci-lint (shared .golangci.yml), ESLint and Prettier, all run in CI API codegen from api/openapi.yaml (npm run generate, drift fails CI): - Go types via oapi-codegen in Server/internal/api - a contract test that the router and the spec list the same routes - Dart models via Phone-App/tool/generate_api.dart; the app uses them Spike: shared Tiptap editor in a Flutter WebView (ADR-4) - @docwell/editor-bridge builds the editor into one HTML page with a versioned JSON protocol; Phone-App hosts it with webview_flutter and a native toolbar. Integration test passes on an Android API 35 emulator. - flutter_inappwebview dropped: its Android plugin fails on AGP 9. Spike: Wails v3 desktop (ADR-11) - system tray, docwell:// deep links (page and space only) with single-instance hand-off, and the built-in updater with a required ed25519 signing key. Verified on Windows. - regenerated build assets register the scheme and drop template placeholders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.2 KiB
Vue
58 lines
2.2 KiB
Vue
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
|
<script setup lang="ts">
|
|
import { ApiError } from "@docwell/api-client";
|
|
import { DwBadge, DwButton, DwCallout, DwLogo, DwTextField } from "@docwell/ui";
|
|
import { ref } from "vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { signIn } from "../session";
|
|
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
const email = ref("");
|
|
const password = ref("");
|
|
const error = ref("");
|
|
const busy = ref(false);
|
|
|
|
const messages: Record<string, string> = {
|
|
invalid_credentials: "Wrong email or password.",
|
|
forbidden: "Only organization admins and superadmins can use the admin panel.",
|
|
account_disabled: "This account is disabled.",
|
|
mfa_required:
|
|
"This account uses two-step sign-in. Sign in to the web app first; MFA for the admin panel is not supported yet.",
|
|
};
|
|
|
|
async function submit() {
|
|
busy.value = true;
|
|
error.value = "";
|
|
try {
|
|
await signIn(email.value, password.value);
|
|
const redirect =
|
|
typeof route.query.redirect === "string" && route.query.redirect.startsWith("/") ? route.query.redirect : "/";
|
|
router.replace(redirect);
|
|
} catch (e) {
|
|
error.value = e instanceof ApiError ? (messages[e.code] ?? "Sign-in failed.") : "Can't reach the server.";
|
|
} finally {
|
|
busy.value = false;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="grid min-h-dvh place-items-center bg-surface-sunken px-4">
|
|
<div class="w-full max-w-sm">
|
|
<div class="mb-8 flex items-center justify-center gap-2">
|
|
<DwLogo class="h-8" />
|
|
<DwBadge tone="accent">Admin</DwBadge>
|
|
</div>
|
|
<form class="space-y-4 dw-card" @submit.prevent="submit">
|
|
<h1 class="text-ui-lg">Sign in to the admin panel</h1>
|
|
<p class="text-ink-muted">Use an organization admin or superadmin account.</p>
|
|
<DwTextField v-model="email" label="Email" type="email" autocomplete="email" required />
|
|
<DwTextField v-model="password" label="Password" type="password" autocomplete="current-password" required />
|
|
<DwCallout v-if="error" tone="danger" size="ui">{{ error }}</DwCallout>
|
|
<DwButton type="submit" variant="primary" class="w-full" :disabled="busy">Sign in</DwButton>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</template>
|