mirror of
https://github.com/certd/certd.git
synced 2026-07-15 02:07:38 +08:00
chore: 登录失败也记录日志
This commit is contained in:
@@ -18,4 +18,5 @@ export type AuditLogContext = {
|
||||
scope?: string;
|
||||
userId?: number;
|
||||
username?: string;
|
||||
success?: boolean;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { createRequestParamDecorator } from "@midwayjs/core";
|
||||
|
||||
export const AuditLog = (opts: { enabled?: boolean }) => {
|
||||
return createRequestParamDecorator(ctx => {
|
||||
if (!ctx.auditLog) {
|
||||
ctx.auditLog = {};
|
||||
}
|
||||
if (opts.enabled !== undefined) {
|
||||
ctx.auditLog.enabled = opts.enabled || true;
|
||||
}
|
||||
return ctx.auditLog;
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./decoractor.js";
|
||||
@@ -7,3 +7,4 @@ export * from "./result.js";
|
||||
export * from "./base-service.js";
|
||||
export * from "./audit.js";
|
||||
export * from "./mode.js";
|
||||
export * from "./core/index.js";
|
||||
|
||||
Reference in New Issue
Block a user