defter 0.3.2

Self-hosted Zotero sync and file storage server, with metadata in SQLite and attachments in S3.
{% extends "base.html" %}

{% block title %}{{ view.title() }}{% endblock %}

{% block content %}
<div class="mx-auto max-w-md rounded-lg border bg-card p-6 space-y-4">
  <h1 class="text-xl font-semibold tracking-tight">{{ view.title() }}</h1>
  <p class="text-sm text-muted-foreground">{{ view.message() }}</p>
  {%- if let LoginView::Pending { token, error } = view %}
  {#- A plain form POST, also without JavaScript: the server checks its Origin
      and the key, and showing this page approves nothing. #}
  <form method="post" action="/login" class="space-y-3">
    <input type="hidden" name="session" value="{{ token }}">
    <label class="block space-y-1">
      <span class="text-sm font-medium">API key</span>
      <input type="password" name="key" required autocomplete="off" spellcheck="false"
             class="w-full rounded-md border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring">
    </label>
    {%- if let Some(error) = error %}
    <p role="alert" class="text-sm text-destructive">{{ error }}</p>
    {%- endif %}
    <button type="submit" class="w-full rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-ring">Approve</button>
  </form>
  {%- endif %}
</div>
{% endblock %}