security: server-owned audit logs + fullscreen custom pages
Port upstream PR #22 + Lite style updates: - lib/audit.js: server-side logAudit(req, action, userId), records IP from x-forwarded-for / cf-connecting-ip - login/register/create_post/create_reply record server-side - Remove client logEvent calls (AppProvider/NewPost/ReplyList) - Remove forgeable POST /api/event-logs endpoint - CustomPage: fullscreen immersive (fixed, 100vh-nav, mobile 56px nav offset) matching upstream Lite
This commit is contained in:
1 parent
45ace3ba75
commit
b9d6ca5da8
11 files changed
+73
-24
No files matched your search
@@ -2,6 +2,7 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import pool from '@/lib/db';
|
||||
import { verifyCaptcha } from '@/lib/captcha';
|
||||
import { logAudit } from '@/lib/audit';
|
||||
|
||||
export async function POST(req) {
|
||||
const { email, password, username, captcha_id, captcha_answer, captcha_sig } = await req.json();
|
||||
@@ -30,6 +31,8 @@ export async function POST(req) {
|
||||
[email, hash, username, avatar, role]
|
||||
);
|
||||
|
||||
// 服务端审计:注册成功
|
||||
await logAudit(req, 'register', r.rows[0].id);
|
||||
return Response.json({
|
||||
user: r.rows[0],
|
||||
message: isFirstUser ? '你是第一个用户,已自动设为管理员!' : '注册成功',
|
||||
|
||||
Reference in new issue
Block a user