mirror of
https://github.com/certd/certd.git
synced 2026-07-17 19:47:34 +08:00
feat: 支持审计日志,操作日志
This commit is contained in:
@@ -6,6 +6,7 @@ import { merge } from "lodash-es";
|
||||
import { TwoFactorService } from "../../../modules/mine/service/two-factor-service.js";
|
||||
import { isPlus } from "@certd/plus-core";
|
||||
import { ApiTags } from "@midwayjs/swagger";
|
||||
import { AuditType } from "../../../modules/sys/enterprise/service/audit-constants.js";
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -19,6 +20,10 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
@Inject()
|
||||
twoFactorService: TwoFactorService;
|
||||
|
||||
getAuditType(): string {
|
||||
return AuditType.mine;
|
||||
}
|
||||
|
||||
@Post("/get", { description: Constants.per.authOnly, summary: "获取双因子认证设置" })
|
||||
async get() {
|
||||
const userId = this.getUserId();
|
||||
@@ -42,6 +47,7 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
}
|
||||
|
||||
await this.service.saveSetting(userId, null, setting);
|
||||
this.auditLog({ content: "保存了双因子认证设置" });
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@@ -62,6 +68,7 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
userId,
|
||||
verifyCode: bean.verifyCode,
|
||||
});
|
||||
this.auditLog({ content: "保存了验证器设置" });
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@@ -69,6 +76,7 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
async authenticatorOff() {
|
||||
const userId = this.getUserId();
|
||||
await this.twoFactorService.offAuthenticator(userId);
|
||||
this.auditLog({ content: "关闭了验证器" });
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user