aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/login.templ
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-12 02:52:22 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-10-12 02:53:52 +0300
commitd05ea66f4bbcf0cc5c8908f3435c68de1b070fa1 (patch)
tree7c7a769206646f2b81a0eda0680f0be5033a4197 /pkg/tpl/login.templ
Начальная версияv0.0.1
Diffstat (limited to 'pkg/tpl/login.templ')
-rw-r--r--pkg/tpl/login.templ60
1 files changed, 60 insertions, 0 deletions
diff --git a/pkg/tpl/login.templ b/pkg/tpl/login.templ
new file mode 100644
index 0000000..1f28e4d
--- /dev/null
+++ b/pkg/tpl/login.templ
@@ -0,0 +1,60 @@
+package tpl
+
+templ Login(form *LoginForm) {
+ @Layout() {
+ <article class="grid">
+ <div>
+ <hgroup>
+ <h1>Вход</h1>
+ <p>Вход в систему</p>
+ </hgroup>
+ <form
+ method="post"
+ hx-post="/user/login"
+ hx-target="form"
+ hx-select="form"
+ hx-indicator="#loader"
+ >
+ if form.Message != "" {
+ <article>
+ <header>Ошибка</header>
+ { form.Message }
+ </article>
+ }
+ <input
+ type="email"
+ name="email"
+ placeholder="Электропочта"
+ aria-label="Электропочта"
+ autocomplete="email"
+ value={ form.Email }
+ required
+ />
+ <input
+ type="password"
+ name="password"
+ placeholder="Пароль"
+ aria-label="Пароль"
+ autocomplete="current-password"
+ required
+ />
+ <fieldset>
+ <label for="remember">
+ <input type="checkbox" role="switch" id="remember" name="remember" checked={ form.Remember }/>
+ Запомнить
+ </label>
+ </fieldset>
+ <button type="submit" class="contrast">Вход</button>
+ </form>
+ </div>
+ <div></div>
+ </article>
+ }
+}
+
+type LoginForm struct {
+ Message string
+ Email string `form:"email"`
+ Password string `form:"password"`
+ Remember string `form:"remember"`
+}