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
@@ -3,6 +3,7 @@ import bcrypt from 'bcryptjs';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import pool from '@/lib/db';
|
||||
import { JWT_SECRET } from '@/lib/auth';
|
||||
import { logAudit } from '@/lib/audit';
|
||||
|
||||
export async function POST(req) {
|
||||
const { email, password } = await req.json();
|
||||
@@ -24,6 +25,8 @@ export async function POST(req) {
|
||||
JWT_SECRET,
|
||||
{ expiresIn: '7d' }
|
||||
);
|
||||
// 服务端审计:登录成功
|
||||
await logAudit(req, 'login', user.id);
|
||||
return Response.json({
|
||||
token,
|
||||
user: {
|
||||
|
||||
Reference in new issue
Block a user