{{define "auth/forgot_password"}}
{{template "base/head" .}}
<main class="j13-main j13-main--solo j13-auth">
  <h1>忘记密码</h1>
  {{template "base/alert" .}}
  {{if .MailReady}}
  <form method="post" action="/forgot-password" class="j13-form" id="forgot-form">
    <input type="hidden" name="_csrf" value="{{.CSRF}}"/>
    <label>注册邮箱
      <input type="email" name="email" required autocomplete="email" value="{{.Email}}"/>
    </label>
    <label>邮箱验证码
      <div class="j13-form__row">
        <input name="email_code" required inputmode="numeric" autocomplete="one-time-code" maxlength="8"/>
        <button type="submit" formaction="/forgot-password/send-code" formnovalidate class="j13-btn-secondary">发送验证码</button>
      </div>
    </label>
    <label>新密码
      <input type="password" name="new_password" required autocomplete="new-password" minlength="6"/>
    </label>
    <label>确认新密码
      <input type="password" name="new_password2" required autocomplete="new-password" minlength="6"/>
    </label>
    <button type="submit">重置密码</button>
  </form>
  <p class="j13-muted">若该邮箱已注册，验证码将发送到邮箱。重置后其它设备会话将失效。</p>
  {{else}}
  <p class="j13-muted">邮件服务未配置，无法通过邮箱重置密码。请联系站长在后台配置 SMTP，或使用其它方式找回。</p>
  {{end}}
  <p><a href="/login">返回登录</a> · <a href="/">返回首页</a></p>
</main>
{{template "base/footer" .}}
{{end}}
