Files
jiang13-forum/templates/auth/register.tmpl
freefire 54f5de07a4 feat: 注册流程强制图形验证码
SSR 注册页与 /api/register 共用 CaptchaService,防刷同时保留换一张无 JS 刷新。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-29 21:13:24 +08:00

48 lines
2.1 KiB
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{define "auth/register"}}
{{template "base/head" .}}
<main class="j13-main j13-main--solo j13-auth">
<h1>注册</h1>
{{template "base/alert" .}}
<form method="post" action="/register" class="j13-form" id="register-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<label>用户名
<input name="username" required autocomplete="username" value="{{.Username}}" maxlength="32"/>
</label>
<label>昵称
<input name="nickname" autocomplete="nickname" value="{{.Nickname}}" maxlength="32" placeholder="可选,默认与用户名相同"/>
</label>
<label>邮箱
<input type="email" name="email" required autocomplete="email" value="{{.Email}}"/>
</label>
{{if .RequireEmailCode}}
<label>邮箱验证码
<div class="j13-form__row">
<input name="email_code" required inputmode="numeric" autocomplete="one-time-code" maxlength="8"/>
<button type="submit" formaction="/register/send-code" formnovalidate class="j13-btn-secondary">发送验证码</button>
</div>
</label>
<p class="j13-muted">邮件服务已启用,注册需验证邮箱。</p>
{{else}}
<p class="j13-muted">邮件服务未配置,可直接注册(管理员可稍后在后台启用 SMTP。</p>
{{end}}
<label>密码
<input type="password" name="password" required autocomplete="new-password" minlength="6"/>
</label>
<label>确认密码
<input type="password" name="password2" required autocomplete="new-password" minlength="6"/>
</label>
<label>图形验证码
<div class="j13-form__row j13-captcha">
<input type="hidden" name="captcha_id" value="{{.CaptchaID}}"/>
{{if .CaptchaSVG}}<span class="j13-captcha__img" aria-hidden="true">{{.CaptchaSVG}}</span>{{end}}
<input name="captcha" required autocomplete="off" maxlength="8" placeholder="请输入图中字符"/>
<a href="/register" class="j13-btn-secondary">换一张</a>
</div>
</label>
<button type="submit">注册</button>
</form>
<p><a href="/login">已有账号?登录</a> · <a href="/">返回首页</a></p>
</main>
{{template "base/footer" .}}
{{end}}