<script lang="ts">
  export let data: null | { code: string };
</script>

<svelte:head>
  <title>Home</title>
</svelte:head>
<h5 class="my-5 mx-auto">Password recovery</h5>
{#if data?.code}
  <form method="POST" action="/recover/reset">
    <input type="hidden" name="code" value={data.code} />
    <label class="form-label mt-2" for="pass">New password</label>
    <input class="form-control" type="password" name="pass" placeholder="Password" />
    <label class="form-label mt-2" for="pass2">Confirm</label>
    <input class="form-control" type="password" name="pass2" placeholder="Password" />
    <div class="mt-4 text-center">
      <button class="btn btn-primary">Ok</button>
    </div>
  </form>
{:else}
  <form method="POST" action="/recover/init">
    <label class="form-label" for="login">Login or email</label>
    <input class="form-control" type="text" name="login" placeholder="Login" />
    <div class="mt-4 text-center">
      <button class="btn btn-primary">Ok</button>
    </div>
  </form>
{/if}