60 lines
1.3 KiB
Text
60 lines
1.3 KiB
Text
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"`
|
|
}
|