defter 0.8.5

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

{% block title %}{{ view.title(t) }}{% 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(t) }}</h1>
  <p class="text-sm text-muted-foreground">{{ view.message(t) }}</p>
  {%- if let LoginView::Pending { token, error, signed_in, oidc, key_login } = view %}
  {%- if *signed_in || *key_login %}
  {#- 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 }}">
    {%- if !*signed_in %}
    <label class="block space-y-1">
      <span class="text-sm font-medium">{{ t.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>
    {%- endif %}
    {%- 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">{{ t.approve }}</button>
  </form>
  {%- endif %}
  {%- if !*signed_in %}
  {%- if let Some(name) = oidc %}
  <a href="/ui/oidc/login?session={{ token }}" class="block w-full rounded-md border px-4 py-2 text-center font-medium hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring">{{ t.sign_in_with }} {{ name }} {{ t.approve_with_end }}</a>
  {%- endif %}
  {%- endif %}
  {%- endif %}
</div>
{% endblock %}