Release v0.20: регистрация, авторизация, личный кабинет
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -396,4 +396,220 @@ a {
|
||||
.features-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.account-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.user-greeting {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Auth */
|
||||
.inline-form {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.user-greeting {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-muted);
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.alert {
|
||||
margin: 1rem 0 0;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background: rgba(72, 187, 120, 0.15);
|
||||
border: 1px solid rgba(72, 187, 120, 0.35);
|
||||
color: #9ae6b4;
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
background: rgba(245, 101, 101, 0.12);
|
||||
border: 1px solid rgba(245, 101, 101, 0.35);
|
||||
color: #feb2b2;
|
||||
}
|
||||
|
||||
.auth-section {
|
||||
padding: 3rem 0 5rem;
|
||||
}
|
||||
|
||||
.auth-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
width: min(420px, 100%);
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.auth-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 2rem;
|
||||
font-weight: 400;
|
||||
margin: 0 0 0.35rem;
|
||||
}
|
||||
|
||||
.auth-sub {
|
||||
color: var(--text-muted);
|
||||
margin: 0 0 1.5rem;
|
||||
}
|
||||
|
||||
.auth-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.form-field span {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.form-field input {
|
||||
padding: 0.65rem 0.85rem;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.form-field input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.form-field input:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-block {
|
||||
width: 100%;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.auth-footer {
|
||||
margin: 1.25rem 0 0;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.auth-footer a {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.auth-footer a:hover {
|
||||
color: var(--accent-hover);
|
||||
}
|
||||
|
||||
/* Account */
|
||||
.account-section {
|
||||
padding: 2.5rem 0 4rem;
|
||||
}
|
||||
|
||||
.account-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 260px 1fr;
|
||||
gap: 2rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.account-user-card {
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.account-label {
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--accent);
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
.account-name {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 0.25rem;
|
||||
}
|
||||
|
||||
.account-email {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.9rem;
|
||||
margin: 0 0 0.75rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.account-meta {
|
||||
font-size: 0.82rem;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.account-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.account-nav-item {
|
||||
display: block;
|
||||
padding: 0.55rem 0.85rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.account-nav-item.active {
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.account-nav-item:hover:not(.active) {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.account-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.account-card h2 {
|
||||
margin: 0 0 1rem;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.account-hint h3 {
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
{{define "account.html"}}
|
||||
{{template "layout" .}}
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<section class="section account-section">
|
||||
<div class="container">
|
||||
<h1 class="section-title">Личный кабинет</h1>
|
||||
<div class="account-grid">
|
||||
<aside class="account-sidebar">
|
||||
<div class="account-user-card">
|
||||
<p class="account-label">Аккаунт</p>
|
||||
<p class="account-name">{{.User.Name}}</p>
|
||||
<p class="account-email">{{.User.Email}}</p>
|
||||
<p class="account-meta">С нами с {{.User.CreatedAt.Format "02.01.2006"}}</p>
|
||||
</div>
|
||||
<nav class="account-nav">
|
||||
<span class="account-nav-item active">Профиль</span>
|
||||
<a href="/#catalog" class="account-nav-item">Каталог</a>
|
||||
</nav>
|
||||
</aside>
|
||||
<div class="account-main">
|
||||
<div class="auth-card account-card">
|
||||
<h2>Настройки профиля</h2>
|
||||
<form method="POST" action="/account" class="auth-form">
|
||||
<label class="form-field">
|
||||
<span>Имя</span>
|
||||
<input type="text" name="name" value="{{.Name}}" required minlength="2">
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>Email</span>
|
||||
<input type="email" value="{{.User.Email}}" disabled>
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="account-hint auth-card">
|
||||
<h3>Заказы</h3>
|
||||
<p class="text-muted">История заказов появится в следующих версиях. Пока вы можете просматривать каталог и добавлять товары в корзину.</p>
|
||||
<a href="/#catalog" class="btn btn-ghost">Перейти в каталог</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
@@ -15,16 +15,27 @@
|
||||
<div class="container header-inner">
|
||||
<a href="/" class="logo">Shop<span>Nova</span></a>
|
||||
<nav class="nav">
|
||||
<a href="/" class="nav-link active">Главная</a>
|
||||
<a href="#catalog" class="nav-link">Каталог</a>
|
||||
<a href="#categories" class="nav-link">Категории</a>
|
||||
<a href="/" class="nav-link{{if eq .Nav "home"}} active{{end}}">Главная</a>
|
||||
<a href="/#catalog" class="nav-link">Каталог</a>
|
||||
{{if .User}}
|
||||
<a href="/account" class="nav-link{{if eq .Nav "account"}} active{{end}}">Личный кабинет</a>
|
||||
{{end}}
|
||||
</nav>
|
||||
<div class="header-actions">
|
||||
<button type="button" class="btn btn-ghost" aria-label="Поиск">Поиск</button>
|
||||
<button type="button" class="btn btn-primary">Корзина</button>
|
||||
{{if .User}}
|
||||
<span class="user-greeting">{{.User.Name}}</span>
|
||||
<form method="POST" action="/logout" class="inline-form">
|
||||
<button type="submit" class="btn btn-ghost">Выйти</button>
|
||||
</form>
|
||||
{{else}}
|
||||
<a href="/login" class="btn btn-ghost">Вход</a>
|
||||
<a href="/register" class="btn btn-primary">Регистрация</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{{if .Success}}<div class="container"><p class="alert alert-success">{{.Success}}</p></div>{{end}}
|
||||
{{if .Error}}<div class="container"><p class="alert alert-error">{{.Error}}</p></div>{{end}}
|
||||
<main>
|
||||
{{template "content" .}}
|
||||
</main>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{{define "login.html"}}
|
||||
{{template "layout" .}}
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<section class="section auth-section">
|
||||
<div class="container auth-container">
|
||||
<div class="auth-card">
|
||||
<h1 class="auth-title">Вход</h1>
|
||||
<p class="auth-sub">Войдите в личный кабинет</p>
|
||||
<form method="POST" action="/login" class="auth-form">
|
||||
<input type="hidden" name="next" value="{{.Next}}">
|
||||
<label class="form-field">
|
||||
<span>Email</span>
|
||||
<input type="email" name="email" value="{{.Email}}" required autocomplete="email">
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>Пароль</span>
|
||||
<input type="password" name="password" required autocomplete="current-password">
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary btn-lg btn-block">Войти</button>
|
||||
</form>
|
||||
<p class="auth-footer">Нет аккаунта? <a href="/register">Регистрация</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{define "register.html"}}
|
||||
{{template "layout" .}}
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<section class="section auth-section">
|
||||
<div class="container auth-container">
|
||||
<div class="auth-card">
|
||||
<h1 class="auth-title">Регистрация</h1>
|
||||
<p class="auth-sub">Создайте аккаунт для заказов и личного кабинета</p>
|
||||
<form method="POST" action="/register" class="auth-form">
|
||||
<label class="form-field">
|
||||
<span>Имя</span>
|
||||
<input type="text" name="name" value="{{.Name}}" required minlength="2" autocomplete="name">
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>Email</span>
|
||||
<input type="email" name="email" value="{{.Email}}" required autocomplete="email">
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>Пароль</span>
|
||||
<input type="password" name="password" required minlength="8" autocomplete="new-password">
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>Повторите пароль</span>
|
||||
<input type="password" name="password_confirm" required minlength="8" autocomplete="new-password">
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary btn-lg btn-block">Зарегистрироваться</button>
|
||||
</form>
|
||||
<p class="auth-footer">Уже есть аккаунт? <a href="/login">Войти</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user