Dough Git

clove/pkviewer

web/src/routes/login/+page.svelte

back to web/src/routes/login

<!-- web/src/routes/login/+page.svelte -->
<script lang="ts">
  import { site } from "$lib/config.ts";
  import Icon from "$lib/components/Icon.svelte";
  import Logo from "$lib/components/Logo.svelte";
  import Meta from "$lib/components/Meta.svelte";

  let { data } = $props();

  // The first screen of the control plane, so it uses the application visual language
  const ERRORS: Record<string, string> = {
    missing_handshake: "That sign-in attempt expired. Please try again.",
    invalid_handshake: "That sign-in attempt could not be verified. Please try again.",
    handshake_expired: "That sign-in attempt took too long. Please try again.",
    state_mismatch: "That sign-in attempt could not be verified. Please try again.",
    discord_denied: "Sign-in was cancelled.",
    missing_code: "Discord did not complete the sign-in. Please try again.",
    discord_error: "Discord could not be reached. Please try again shortly.",
    signup_disabled: "New accounts are closed at the moment.",
    unavailable: "Sign-in is unavailable right now. Please try again shortly.",
  };
</script>

<Meta title="Sign in · pkviewer" noindex />

<div class="mg">
  <header class="mg-bar">
    <span class="mg-brand">
      <Logo />
      pkviewer
    </span>
    <span class="mg-bar-note">Sign in</span>
    <span class="spacer"></span>
    <a class="btn" href={site.publicOrigin}>Public site</a>
  </header>

  <div class="mg-shell" style="max-width: 34rem">
    <div class="mg-head">
      <h1>Sign in to pkviewer</h1>
      <p>Manage and customise a system you already have on PluralKit.</p>
    </div>

    {#if data.error}
      <p class="mg-note" data-tone="warn" role="alert">
        <Icon name="exclamation-triangle" />
        <span>{ERRORS[data.error] ?? "Sign-in did not complete. Please try again."}</span>
      </p>
    {/if}

    <section class="mg-panel">
      <h2>Continue with Discord</h2>
      <p class="hint">
        pkviewer asks Discord only for your account ID and username. Not your
        servers, not your messages, not your email.
      </p>
      <p style="margin-bottom: 0">
        <a
          class="btn"
          href="/auth/discord/start?return_to={encodeURIComponent(data.destination)}"
          style="font-weight: 600"
          data-sveltekit-reload
        >
          <Icon name="discord" /> Continue with Discord
        </a>
      </p>
    </section>

    <section class="mg-panel">
      <h2>You may not need an account</h2>
      <p class="hint" style="margin-bottom: 0">
        Public system and member pages are open to everyone, with no sign-in.
        An account is only for managing and customising a system — and
        pkviewer never asks for a PluralKit token in order to claim one.
      </p>
    </section>
  </div>
</div>