feat(web-site): harden sample desk, auth login, and form layout

Align nav/side/foot slots and shell CSS with table-driven admin desk;
add session login/logout mount and widen form fields for usable create UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-16 19:44:12 +08:00
1 parent 037592087c
commit 52b4bae423
14 files changed
+245 -73

No files matched your search

@@ -0,0 +1,29 @@
---
title: components/desk
description: 管理台壳 — 顶栏品牌为「后台」,无前台侧栏。
---
## nav
`nav` =
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| 后台 | /admin | | | |
| 站点 | / | | | |
| 写文章 | /new | | | |
| 退出 | /admin/logout | | | auth |
*`nav`*
## foot
`foot` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 站点 | / | |
| 后台 | /admin | |
| 退出 | /admin/logout | |
*`foot`*
@@ -8,3 +8,4 @@
| Source | https://github.com/cflmy/marqdo | |
*`foot`*
+10 -6
View File
@@ -1,12 +1,16 @@
## nav
顶栏:**登录**(访客)/ **后台** + **退出**(已登录)。
`nav` =
| 属性 | 值 | 样式 |
|------|-----|------|
| Marqdo | / | |
| 关于 | /about | |
| 写文章 | /new | |
| 后台 | /admin | |
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| Marqdo | / | | | |
| 关于 | /about | | | |
| 写文章 | /new | | | |
| 登录 | /login | | | guest |
| 后台 | /admin | | | auth |
| 退出 | /admin/logout | | | auth |
*`nav`*
+7 -6
View File
@@ -2,11 +2,12 @@
`side` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 1. 首页 | / | |
| 2. 写文章 | /new | |
| 3. 后台 | /admin | |
| 关于 | /about | |
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| 1. 首页 | / | | | |
| 2. 写文章 | /new | | | |
| 3. 登录 | /login | | | guest |
| 3. 后台 | /admin | | | auth |
| 关于 | /about | | | |
*`side`*
+34 -10
View File
@@ -7,6 +7,7 @@ import shell:styles/shell.mq.md
import nav:components/nav.mq.md
import side:components/side.mq.md
import foot:components/foot.mq.md
import desk:components/desk.mq.md
import articles:db/articles.mq.md
import db:db/index.mq.md
---
@@ -23,6 +24,15 @@ import db:db/index.mq.md
| side.`side` | shell.`side_panel` |
| foot.`foot` | shell.`footer` |
后台壳:去掉前台侧栏,顶栏品牌改为「后台」。
`desk_shell` =
| 组件 | 样式 |
|------|------|
| desk.`nav` | shell.`topnav` |
| desk.`foot` | shell.`footer` |
`index` =
| 属性 | 值 | 样式 |
@@ -56,7 +66,7 @@ import db:db/index.mq.md
| 标签 | GFM 表 | shell.`claim` |
| 步骤 | "点击任意卡片 — /post/{slug} 用同一张 articles 表打开详情。" | shell.`step` |
| 步骤 | "打开 [写文章](/new),空标题提交(规则表校验)。" | shell.`step` |
| 步骤 | "填写合法标题与 slug 提交 — 首页与后台都会出现。" | shell.`step` |
| 步骤 | "点顶栏 **登录**(admin / demo),再进 **后台** — 门禁管理台:创建表单 + 列表。" | shell.`step` |
`关于引言` =
@@ -78,9 +88,12 @@ import db:db/index.mq.md
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | 后台 · 表声明 | shell.`kicker` |
| 眉题 | 管理台 · 已进入后台 | shell.`kicker` |
| 标题 | 后台 | shell.`intro_title` |
| 导语 | "列表与创建共用 articles schema;卡片可点进详情——不是另写一套 JS 管理端。" | shell.`lede` |
| 导语 | "这就是管理台(需登录):与前台共用 articles schema,装配成列表 + 创建表单——不是另写一套 SPA。顶栏「站点」回前台,「退出」结束会话。" | shell.`lede` |
| 标签 | 登录门禁 | shell.`claim` |
| 标签 | 表声明 | shell.`claim` |
| 标签 | "创建 + 列表" | shell.`claim` |
`文章引言` =
@@ -131,7 +144,7 @@ import db:db/index.mq.md
**page = > page.引言装配 引言=`首页引言`**
**page = > page.元数据 元数据=home_meta**
**page = > page.头装配 表=fonts**
**page = > page.css css=site_css**
**page = > page.样式 样式=site_css**
**page = > page.组件装配 组件=home**
**page = > page.主体装配 主体=index**
**page = > page.链接前缀 前缀="/post/"**
@@ -139,7 +152,7 @@ import db:db/index.mq.md
**about = > 网页.页面 标题="关于 · Marqdo 中文站" 壳样式="off"**
**about = > about.引言装配 引言=`关于引言`**
**about = > about.头装配 表=fonts**
**about = > about.css css=site_css**
**about = > about.样式 样式=site_css**
**about = > about.组件装配 组件=home**
**article_form = > 网页.表单 表="articles" 动作="插入"**
@@ -149,15 +162,16 @@ import db:db/index.mq.md
**new = > 网页.页面 标题="写文章 · Marqdo 中文站" 壳样式="off"**
**new = > new.引言装配 引言=`写文章引言`**
**new = > new.头装配 表=fonts**
**new = > new.css css=site_css**
**new = > new.样式 样式=site_css**
**new = > new.组件装配 组件=home**
**new = > new.表单装配 id="article" 表单=article_form**
**desk = > 网页.页面 标题="后台 · Marqdo 中文站" 壳样式="off"**
**desk = > desk.壳HTML 体类="is-desk"**
**desk = > desk.引言装配 引言=`后台引言`**
**desk = > desk.头装配 表=fonts**
**desk = > desk.css css=site_css**
**desk = > desk.组件装配 组件=home**
**desk = > desk.样式 样式=site_css**
**desk = > desk.组件装配 组件=desk_shell**
**desk = > desk.表单装配 id="article" 表单=article_form**
**desk = > desk.主体装配 主体=index**
**desk = > desk.链接前缀 前缀="/post/"**
@@ -165,15 +179,25 @@ import db:db/index.mq.md
**post = > 网页.页面 标题="文章 · Marqdo 中文站" 壳样式="off"**
**post = > post.引言装配 引言=`文章引言`**
**post = > post.头装配 表=fonts**
**post = > post.css css=site_css**
**post = > post.样式 样式=site_css**
**post = > post.组件装配 组件=home**
**post = > post.主体装配 主体=detail**
**post = > post.查询条件 条件=by_slug**
**post = > post.详情 详情=True**
**app = > 网页.应用 页面=page 数据库=store 后台=False 主机="127.0.0.1" 端口=18082 壳样式="off"**
演示账号(用户表声明;宿主会话鉴权,无作者 JS)。
`管理员` =
| 用户名 | 密码 | 角色 |
|--------|------|------|
| admin | demo | admin |
**app = > 网页.应用 页面=page 数据库=store 后台=False 主机="127.0.0.1" 端口=18082 壳样式="off" 登录回跳="/admin" 登出回跳="/"**
**app = > app.路由 路径="/about" 页面=about**
**app = > app.路由 路径="/new" 页面=new**
**app = > app.路由 路径="/admin" 页面=desk**
**app = > app.路由 路径="/post/{slug}" 页面=post**
**app = > app.鉴权 用户表=`管理员` 会话时长=3600 登录路径="/login" 登录回跳="/admin" 登出回跳="/"**
**app = > app.门禁 路径="/admin" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/login"**
> `app`.监听
+37 -13
View File
@@ -3,7 +3,7 @@ title: styles/shell
description: >-
Literary dark theme for examples/web-site — ink / wine / gold after the
anlian.cyou Zhang Ailing topic. GFM tables only; no author .css.
导入 网页:ext/web/网页.mq.md
import web:ext/web/web.mq.md
import text:lib/text.mq.md
---
@@ -151,6 +151,8 @@ wine, cold gold, serif display.
| body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" |
| body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' |
| body.no-sidebar | grid-template-areas | '"top" "main" "foot"' |
| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' |
| body.is-desk | grid-template-areas | '"top" "main" "foot"' |
| header.topnav | grid-area | top |
| aside.side | grid-area | side |
| main.main | grid-area | main |
@@ -186,14 +188,17 @@ wine, cold gold, serif display.
`responsive` =
| media | 选择器 | 属性 | 值 |
|-------|--------|------|-----|
| 媒体 | 选择器 | 属性 | 值 |
|------|--------|------|-----|
| (max-width: 860px) | body.has-sidebar | grid-template-columns | 1fr |
| (max-width: 860px) | body.has-sidebar | grid-template-areas | '"top" "main" "side" "foot"' |
| (max-width: 860px) | aside.side | border-right | "0" |
| (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) |
| (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" |
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form form | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" |
| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" |
| (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" |
| (max-width: 860px) | .intro_title | font-size | "2.4rem" |
| (prefers-reduced-motion: reduce) | main.main | animation | none |
@@ -455,6 +460,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| ul.nav a:hover | background | transparent |
| ul.nav a:hover | color | var(--gold) |
| ul.nav a:hover | text-decoration | none |
| ul.nav a[href="/admin"] | color | var(--gold) |
| ul.nav a[href="/admin"] | letter-spacing | "0.18em" |
| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) |
| ul.side-nav a[href="/admin"] | color | var(--gold) |
| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) |
| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" |
| body.is-desk .main-intro | border-left | 3px solid var(--wine) |
| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) |
| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" |
| body.is-desk .content.cards | margin-top | var(--space-6) |
| ul.nav li:first-child a | font-family | var(--display) |
| ul.nav li:first-child a | font-weight | "400" |
| ul.nav li:first-child a | color | var(--gold) |
@@ -466,7 +481,7 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .side-label | display | block |
| .side-label | font-size | "0" |
| .side-label | margin | "0 0 var(--space-4)" |
| .side-label::before | content | '"路径"' |
| .side-label::before | content | '"Path"' |
| .side-label::before | display | block |
| .side-label::before | font-size | "0.68rem" |
| .side-label::before | letter-spacing | "0.28em" |
@@ -522,15 +537,18 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form | background | var(--glass) |
| .site-form | border | 1px solid var(--border) |
| .site-form | border-radius | var(--radius) |
| .site-form | padding | "var(--space-6)" |
| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" |
| .site-form | margin | "0 0 var(--space-6)" |
| .site-form | max-width | "28rem" |
| .site-form | max-width | "100%" |
| .site-form | width | "100%" |
| .site-form | box-shadow | var(--shadow) |
| .site-form | backdrop-filter | blur(16px) |
| .site-form | -webkit-backdrop-filter | blur(16px) |
| .site-form .meta | display | none |
| .site-form form | display | grid |
| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" |
| .site-form form | column-gap | var(--space-5) |
| .site-form form | row-gap | var(--space-5) |
| .site-form form | gap | var(--space-5) |
| .site-form form | margin | "0" |
| .site-form form | width | "100%" |
@@ -538,11 +556,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form label | display | grid |
| .site-form label | gap | var(--space-2) |
| .site-form label | margin | "0" |
| .site-form label | min-width | "0" |
| .site-form label | font-weight | "400" |
| .site-form label | color | var(--gold) |
| .site-form label | font-size | "0.78rem" |
| .site-form label | letter-spacing | "0.16em" |
| .site-form label | text-transform | uppercase |
| .site-form label:nth-child(1) | grid-column | "1" |
| .site-form label:nth-child(2) | grid-column | "2" |
| .site-form label:nth-child(n+3) | grid-column | "1 / -1" |
| .site-form .actions | grid-column | "1 / -1" |
| .site-form input | -webkit-appearance | none |
| .site-form textarea | -webkit-appearance | none |
| .site-form input | appearance | none |
@@ -554,7 +577,8 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form input | width | "100%" |
| .site-form textarea | width | "100%" |
| .site-form input | height | "2.75rem" |
| .site-form textarea | min-height | "8.5rem" |
| .site-form textarea | min-height | "10rem" |
| .site-form label:nth-child(4) textarea | min-height | "14rem" |
| .site-form textarea | resize | vertical |
| .site-form input | padding | "0 0.9rem" |
| .site-form textarea | padding | "0.75rem 0.9rem" |
@@ -629,12 +653,12 @@ Panel + claim/steps group layout (field look comes from named bind styles).
**r = > responsive**
**c = > chrome**
**w = > widgets**
**css_v = > 网页.样式装配 名="vars" 表=v**
**css_m = > 网页.样式装配 名="motion" 表=m**
**css_l = > 网页.样式装配 名="layout" 表=l**
**css_r = > 网页.样式装配 名="responsive" 表=r**
**css_c = > 网页.样式装配 名="chrome" 表=c**
**css_w = > 网页.样式装配 名="widgets" 表=w**
**css_v = > web.make_style name="vars" table=v**
**css_m = > web.make_style name="motion" table=m**
**css_l = > web.make_style name="layout" table=l**
**css_r = > web.make_style name="responsive" table=r**
**css_c = > web.make_style name="chrome" table=c**
**css_w = > web.make_style name="widgets" table=w**
`parts` =
+1 -1
View File
@@ -21,7 +21,7 @@ Open http://127.0.0.1:18081/
| 3 | Open `index.mq.md` beside the browser | Narrative = program; field/rule/route/intro tables |
| 4 | `/new` empty title → submit | Server validation from **rule table** (no author JS) |
| 5 | `/new` valid title+slug → submit | Row appears on Home and Admin |
| 6 | `/admin` | List + create form — table-declared admin, not an SPA |
| 6 | Top-nav **Login** (`admin` / `demo`) → **Admin** | Session gate; desk shell + create form |
| 7 | Terminal check | `find examples/web-site \( -name '*.js' -o -name '*.css' \)` → **0** |
## Authoring contract
+29
View File
@@ -0,0 +1,29 @@
---
title: components/desk
description: Admin desk chrome — brand reads Admin; no public side rail.
---
## nav
`nav` =
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Admin | /admin | | | |
| Site | / | | | |
| New | /new | | | |
| Logout | /admin/logout | | | auth |
*`nav`*
## foot
`foot` =
| front | back | style |
|-------|------|-------|
| Site | / | |
| Admin | /admin | |
| Logout | /admin/logout | |
*`foot`*
+1
View File
@@ -8,3 +8,4 @@
| Source | https://github.com/cflmy/marqdo | |
*`foot`*
+9 -7
View File
@@ -1,14 +1,16 @@
## nav
Brand first, then demo routes.
Brand first, then demo routes. Guest sees **Login**; signed-in sees **Admin** + **Logout**.
`nav` =
| front | back | style |
|-------|------|-------|
| Marqdo | / | |
| About | /about | |
| New | /new | |
| Admin | /admin | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Marqdo | / | | | |
| About | /about | | | |
| New | /new | | | |
| Login | /login | | | guest |
| Admin | /admin | | | auth |
| Logout | /admin/logout | | | auth |
*`nav`*
+7 -6
View File
@@ -4,11 +4,12 @@ Hands-on demo checklist (links only — no JS).
`side` =
| front | back | style |
|-------|------|-------|
| 1. Home | / | |
| 2. New form | /new | |
| 3. Admin | /admin | |
| About | /about | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| 1. Home | / | | | |
| 2. New form | /new | | | |
| 3. Login | /login | | | guest |
| 3. Admin | /admin | | | auth |
| About | /about | | | |
*`side`*
+29 -5
View File
@@ -8,6 +8,7 @@ import shell:styles/shell.mq.md
import nav:components/nav.mq.md
import side:components/side.mq.md
import foot:components/foot.mq.md
import desk:components/desk.mq.md
import articles:db/articles.mq.md
import db:db/index.mq.md
---
@@ -26,6 +27,15 @@ no hand-written business JavaScript and no author .css file.
| side.`side` | shell.`side_panel` |
| foot.`foot` | shell.`footer` |
Public shell (nav + side + foot). Desk shell drops the public side rail.
`desk_shell` =
| src | style |
|-----|-------|
| desk.`nav` | shell.`topnav` |
| desk.`foot` | shell.`footer` |
List cards: summary + slug link (click through to detail).
`index` =
@@ -65,7 +75,7 @@ Home intro — same bind shape as main (front / back / style).
| claim | GFM tables | shell.`claim` |
| step | "Click any card — /post/{slug} opens the detail page from the same articles table." | shell.`step` |
| step | "Open [New](/new) and submit with an empty title (validation from a rule table)." | shell.`step` |
| step | "Submit a valid article — it appears on [Home](/) and [Admin](/admin)." | shell.`step` |
| step | "Open top-nav **Login** (admin / demo), then **Admin** — gated desk with create form + list." | shell.`step` |
`about_intro` =
@@ -90,9 +100,12 @@ Home intro — same bind shape as main (front / back / style).
| front | back | style |
|-------|------|-------|
| kicker | admin · table-declared | shell.`kicker` |
| kicker | desk · you are in admin | shell.`kicker` |
| title | Admin | shell.`intro_title` |
| lede | "List and create share the articles schema. Cards link to detail pages — no separate admin SPA." | shell.`lede` |
| lede | "This is the management desk (login required): same articles schema as the public site, assembled as list + create form — not a separate SPA. Use Site in the topnav to return, or Logout to end the session." | shell.`lede` |
| claim | login-gated | shell.`claim` |
| claim | table-declared | shell.`claim` |
| claim | "create + list" | shell.`claim` |
`post_intro` =
@@ -172,10 +185,11 @@ Neat CJK sans for body; Great Vibes for English display.
**new = > new.compose_form id="article" form=article_form**
**desk = > web.page title="Admin · Marqdo Web" shell_css="off"**
**desk = > desk.chrome body_class="is-desk"**
**desk = > desk.compose_intro intro=admin_intro**
**desk = > desk.head table=fonts**
**desk = > desk.css css=site_css**
**desk = > desk.compose_components components=home**
**desk = > desk.compose_components components=desk_shell**
**desk = > desk.compose_form id="article" form=article_form**
**desk = > desk.compose_main main=index**
**desk = > desk.link_prefix prefix="/post/"**
@@ -189,9 +203,19 @@ Neat CJK sans for body; Great Vibes for English display.
**post = > post.query query=by_slug**
**post = > post.detail detail=True**
**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off"**
Demo credentials (table-declared users — host session auth, no author JS).
`admins` =
| username | password | role |
|----------|----------|------|
| admin | demo | admin |
**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off" login_redirect="/admin" logout_redirect="/"**
**app = > app.route path="/about" page=about**
**app = > app.route path="/new" page=new**
**app = > app.route path="/admin" page=desk**
**app = > app.route path="/post/{slug}" page=post**
**app = > app.auth users=admins session_ttl=3600 login_path="/login" login_redirect="/admin" logout_redirect="/"**
**app = > app.gate path="/admin" roles="admin" match="prefix" on_deny="redirect" exclude="/login"**
> `app`.listen
+27 -3
View File
@@ -151,6 +151,8 @@ wine, cold gold, serif display.
| body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" |
| body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' |
| body.no-sidebar | grid-template-areas | '"top" "main" "foot"' |
| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' |
| body.is-desk | grid-template-areas | '"top" "main" "foot"' |
| header.topnav | grid-area | top |
| aside.side | grid-area | side |
| main.main | grid-area | main |
@@ -194,6 +196,9 @@ wine, cold gold, serif display.
| (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) |
| (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" |
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form form | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" |
| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" |
| (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" |
| (max-width: 860px) | .intro_title | font-size | "2.4rem" |
| (prefers-reduced-motion: reduce) | main.main | animation | none |
@@ -455,6 +460,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| ul.nav a:hover | background | transparent |
| ul.nav a:hover | color | var(--gold) |
| ul.nav a:hover | text-decoration | none |
| ul.nav a[href="/admin"] | color | var(--gold) |
| ul.nav a[href="/admin"] | letter-spacing | "0.18em" |
| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) |
| ul.side-nav a[href="/admin"] | color | var(--gold) |
| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) |
| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" |
| body.is-desk .main-intro | border-left | 3px solid var(--wine) |
| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) |
| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" |
| body.is-desk .content.cards | margin-top | var(--space-6) |
| ul.nav li:first-child a | font-family | var(--display) |
| ul.nav li:first-child a | font-weight | "400" |
| ul.nav li:first-child a | color | var(--gold) |
@@ -522,15 +537,18 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form | background | var(--glass) |
| .site-form | border | 1px solid var(--border) |
| .site-form | border-radius | var(--radius) |
| .site-form | padding | "var(--space-6)" |
| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" |
| .site-form | margin | "0 0 var(--space-6)" |
| .site-form | max-width | "28rem" |
| .site-form | max-width | "100%" |
| .site-form | width | "100%" |
| .site-form | box-shadow | var(--shadow) |
| .site-form | backdrop-filter | blur(16px) |
| .site-form | -webkit-backdrop-filter | blur(16px) |
| .site-form .meta | display | none |
| .site-form form | display | grid |
| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" |
| .site-form form | column-gap | var(--space-5) |
| .site-form form | row-gap | var(--space-5) |
| .site-form form | gap | var(--space-5) |
| .site-form form | margin | "0" |
| .site-form form | width | "100%" |
@@ -538,11 +556,16 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form label | display | grid |
| .site-form label | gap | var(--space-2) |
| .site-form label | margin | "0" |
| .site-form label | min-width | "0" |
| .site-form label | font-weight | "400" |
| .site-form label | color | var(--gold) |
| .site-form label | font-size | "0.78rem" |
| .site-form label | letter-spacing | "0.16em" |
| .site-form label | text-transform | uppercase |
| .site-form label:nth-child(1) | grid-column | "1" |
| .site-form label:nth-child(2) | grid-column | "2" |
| .site-form label:nth-child(n+3) | grid-column | "1 / -1" |
| .site-form .actions | grid-column | "1 / -1" |
| .site-form input | -webkit-appearance | none |
| .site-form textarea | -webkit-appearance | none |
| .site-form input | appearance | none |
@@ -554,7 +577,8 @@ Panel + claim/steps group layout (field look comes from named bind styles).
| .site-form input | width | "100%" |
| .site-form textarea | width | "100%" |
| .site-form input | height | "2.75rem" |
| .site-form textarea | min-height | "8.5rem" |
| .site-form textarea | min-height | "10rem" |
| .site-form label:nth-child(4) textarea | min-height | "14rem" |
| .site-form textarea | resize | vertical |
| .site-form input | padding | "0 0.9rem" |
| .site-form textarea | padding | "0.75rem 0.9rem" |
+24 -16
View File
@@ -314,9 +314,10 @@ func (st *state) mountAuthRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET "+altLogin, st.handleLoginGet)
mux.HandleFunc("POST "+altLogin, st.handleLoginPost)
}
// Logout is part of session auth, not only built-in admin=True chrome.
logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout"
mux.HandleFunc("GET "+logoutPath, st.handleLogout)
if st.auth.admin {
logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout"
mux.HandleFunc("GET "+logoutPath, st.handleLogout)
adminHome := strings.TrimRight(st.auth.adminPrefix, "/")
if adminHome == "" {
adminHome = "/admin"
@@ -427,29 +428,34 @@ func loginPageHTML(loginAction string, errMsg *string, csrf string, next string)
nextField = fmt.Sprintf("<input type=\"hidden\" name=\"next\" value=\"%s\"/>", esc(next))
}
return fmt.Sprintf(`<!DOCTYPE html>
<html lang="zh-CN"><head>
<html lang="en"><head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Admin Login</title>
<style>
:root { --ink:#1c1917; --muted:#78716c; --paper:#fafaf9; --line:#e7e5e4; --accent:#0f766e; --err:#b91c1c; }
:root { --ink:#0a0809; --paper:#f5e6c8; --gold:#d4af37; --wine:#6b1e3a; --err:#b91c1c; }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; display:grid; place-items:center; background:var(--paper); color:var(--ink); font-family:"IBM Plex Sans","Noto Sans SC",sans-serif; }
.login { background:rgba(255,255,255,.45); border:1px solid rgba(255,255,255,.5); border-radius:14px; padding:2rem 2.25rem; width:min(92vw,22rem); box-shadow:0 8px 24px rgba(253,189,219,.18); backdrop-filter:blur(14px); }
.login h1 { margin:0 0 .25rem; font-size:1.4rem; color:#a85878; }
.login .sub { color:#666; margin:0 0 1.25rem; font-size:.9rem; }
body { margin:0; min-height:100vh; display:grid; place-items:center; color:var(--paper); font-family:"Noto Sans SC","IBM Plex Sans",system-ui,sans-serif;
background: radial-gradient(ellipse 90%% 55%% at 50%% -15%%, rgba(107,30,58,.5), transparent 58%%), linear-gradient(180deg,#0a0809,#120c10 45%%,#0a0809); }
.login { background:rgba(0,0,0,.45); border:1px solid rgba(212,175,55,.28); border-radius:12px; padding:2rem 2.25rem; width:min(92vw,22rem); box-shadow:0 24px 80px rgba(0,0,0,.55); backdrop-filter:blur(14px); }
.login h1 { margin:0 0 .25rem; font-size:1.55rem; color:var(--gold); letter-spacing:.04em; }
.login .sub { color:rgba(245,230,200,.72); margin:0 0 1.25rem; font-size:.9rem; line-height:1.55; }
.login .hint { color:rgba(245,230,200,.5); margin:1rem 0 0; font-size:.78rem; letter-spacing:.04em; }
.login form { display:grid; gap:.9rem; }
.login label { display:grid; gap:.25rem; font-size:.9rem; }
.login input { padding:.55rem .65rem; border:1px solid rgba(253,189,219,.55); border-radius:999px; font:inherit; background:rgba(255,255,255,.7); }
.login button { background:linear-gradient(120deg,#f0a8c4,#fdbbdb); color:#a85878; border:0; padding:.6rem 1rem; border-radius:999px; cursor:pointer; font:inherit; font-weight:600; }
.login button:hover { filter:brightness(1.05); }
.flash.err { background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; padding:.6rem .8rem; border-radius:6px; margin:0 0 .9rem; font-size:.9rem; }
.login label { display:grid; gap:.25rem; font-size:.85rem; letter-spacing:.08em; }
.login input { padding:.6rem .75rem; border:1px solid rgba(212,175,55,.35); border-radius:8px; font:inherit; color:var(--paper); background:rgba(10,8,9,.7); }
.login input:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 2px rgba(212,175,55,.25); }
.login button { background:linear-gradient(135deg,#f5e6c8,var(--gold)); color:var(--ink); border:0; padding:.65rem 1rem; border-radius:999px; cursor:pointer; font:inherit; font-weight:600; letter-spacing:.1em; }
.login button:hover { filter:brightness(1.06); }
.flash.err { background:rgba(185,28,28,.15); color:#fecaca; border:1px solid rgba(185,28,28,.45); padding:.6rem .8rem; border-radius:8px; margin:0 0 .9rem; font-size:.9rem; }
a.back { color:var(--gold); text-decoration:none; font-size:.85rem; }
a.back:hover { color:#f5e6c8; }
</style>
</head>
<body style="background:#f8f9fa url('/static/img/bg-body-960.webp') center/cover fixed;">
<body>
<div class="login">
<h1>暗恋见君</h1>
<p class="sub">登录后发帖与管理。</p>
<h1>Marqdo Admin</h1>
<p class="sub">Sign in to open the table-declared desk.</p>
%s
<form method="post" action="%s">
%s%s
@@ -457,6 +463,8 @@ body { margin:0; min-height:100vh; display:grid; place-items:center; background:
<label>Password<input name="password" type="password" autocomplete="current-password" required/></label>
<button type="submit">Sign in</button>
</form>
<p class="hint">Demo · admin / demo</p>
<p style="margin:1.1rem 0 0"><a class="back" href="/">← Site</a></p>
</div>
</body></html>`, errHTML, esc(loginAction), csrfField, nextField)
}