form.hbs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <form id="login-signup" hx-post="/api/auth/login" hx-swap="outerHTML">
  2. <label class="{{#if errors.email}}error{{/if}}">
  3. Email address:
  4. <input
  5. name="email"
  6. id="email"
  7. type="email"
  8. autofocus="true"
  9. placeholder="Email address..."
  10. hx-preserve="true"
  11. />
  12. {{#if errors.email}}<p class="error">{{errors.email}}</p>{{/if}}
  13. </label>
  14. <label class="{{#if errors.password}}error{{/if}}">
  15. Password:
  16. <input
  17. name="password"
  18. id="password"
  19. type="password"
  20. placeholder="Password..."
  21. hx-preserve="true"
  22. />
  23. {{#if errors.password}}<p class="error">{{errors.password}}</p>{{/if}}
  24. </label>
  25. {{!-- TODO: Agree with terms --}}
  26. <div class="buttons-wrapper">
  27. <button type="submit" class="primary login">
  28. <svg class="with-text icon" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000" viewBox="0 0 24 24"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4m-5-4 5-5-5-5m3.8 5H3"/></svg>
  29. <svg class="with-text spinner" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M12 2v4m0 12v4M5 5l2.8 2.8m8.4 8.4 2.9 2.9M2 12h4m12 0h4M5 19l2.8-2.8m8.4-8.4 2.9-2.9"/></svg>
  30. Log in
  31. </button>
  32. <button
  33. class="secondary signup"
  34. hx-post="/api/auth/signup"
  35. hx-target="#login-signup"
  36. hx-trigger="click"
  37. hx-indicator="#login-signup"
  38. hx-swap="outerHTML"
  39. hx-sync="closest form"
  40. hx-on:htmx:before-request="htmx.addClass('#login-signup', 'signup')"
  41. hx-on:htmx:after-request="htmx.removeClass('#login-signup', 'signup')"
  42. >
  43. <svg class="with-text icon" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000" viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><path d="M20 8v6m3-3h-6"/></svg>
  44. <svg class="with-text spinner" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M12 2v4m0 12v4M5 5l2.8 2.8m8.4 8.4 2.9 2.9M2 12h4m12 0h4M5 19l2.8-2.8m8.4-8.4 2.9-2.9"/></svg>
  45. Sign up
  46. </button>
  47. </div>
  48. <a class="forgot-password" href="/forgot-password" title="Reset password">Forgot your password?</a>
  49. {{#unless errors}}
  50. {{#if error}}
  51. <p class="error">{{error}}</p>
  52. {{/if}}
  53. {{/unless}}
  54. </form>