framework/pkg/tpl/register.templ

63 lines
1.4 KiB
Text

package tpl
templ Register(form *RegisterForm) {
@Layout() {
<article class="grid">
<div>
<hgroup>
<h1>Регистрация</h1>
<p>Регистрация в системе</p>
</hgroup>
<form
method="post"
hx-post="/user/register"
hx-target="form"
hx-select="form"
hx-indicator="#loader"
>
if form.Message != "" {
<article>
<header>Ошибка</header>
{ form.Message }
</article>
}
<input
type="text"
name="username"
placeholder="Отображаемое имя"
aria-label="Отображаемое имя"
autocomplete="username"
value={ form.Username }
required
/>
<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
/>
<button type="submit" class="contrast">Регистрация</button>
</form>
</div>
<div></div>
</article>
}
}
type RegisterForm struct {
Message string
Username string `form:"username"`
Email string `form:"email"`
Password string `form:"password"`
}