aboutsummaryrefslogblamecommitdiff
path: root/pkg/tpl/register.templ
blob: c7c7210f59c28abcda42c1bbeb3f0d39d8b82aa0 (plain) (tree)






























































                                                                                                              
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"`
}