From 8d9dad9c82f6f2fd3ab3040068946a33f37145b1 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 7 Jul 2026 09:43:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E5=BC=B9=E5=87=BA=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=8F=90=E9=86=92=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/framework/home/index.vue | 6 ++++ .../controller/user/mine/mine-controller.ts | 29 ++++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/ui/certd-client/src/views/framework/home/index.vue b/packages/ui/certd-client/src/views/framework/home/index.vue index 78c096e93..1405446d7 100644 --- a/packages/ui/certd-client/src/views/framework/home/index.vue +++ b/packages/ui/certd-client/src/views/framework/home/index.vue @@ -15,11 +15,14 @@ import { Modal, notification } from "ant-design-vue"; import { useI18n } from "/src/locales"; import { request } from "/@/api/service"; import { useFormDialog } from "/@/use/use-dialog"; +import { useSettingStore } from "/@/store/settings/index.jsx"; const { t } = useI18n(); const { openFormDialog } = useFormDialog(); const userStore = useUserStore(); +const settingStore = useSettingStore(); + const changePasswordButtonRef = ref(); const emailFormWrapperRef = ref(); @@ -34,6 +37,9 @@ const validateEmailConfirm = async (_rule: any, value: string) => { }; async function checkAndSetupAccount() { + if (settingStore.isEnterprise) { + return; + } try { const userInfo = userStore.getUserInfo as any; if (!userInfo.needInitAccount) { diff --git a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts index 301ec9dcd..8c4b7ea5d 100644 --- a/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts +++ b/packages/ui/certd-server/src/controller/user/mine/mine-controller.ts @@ -1,4 +1,4 @@ -import { AccessGetter, AccessService, BaseController, Constants, SysSettingsService } from "@certd/lib-server"; +import { AccessGetter, AccessService, BaseController, Constants, isEnterprise, SysSettingsService } from "@certd/lib-server"; import { ALL, Body, Controller, Inject, Post, Provide } from "@midwayjs/core"; import { PasskeyService } from "../../../modules/login/service/passkey-service.js"; import { RoleService } from "../../../modules/sys/authority/service/role-service.js"; @@ -54,14 +54,18 @@ export class MineController extends BaseController { delete user.password; //@ts-ignore user.needInitPassword = needInitPassword; - - const existingAccess = await this.accessService.findOne({ - where: { type: "acmeAccount", subtype: "letsencrypt", userId }, - }); - if (!existingAccess) { - //@ts-ignore - user.needInitAccount = true; + //@ts-ignore + user.needInitAccount = false; + if (!isEnterprise()) { + const existingAccess = await this.accessService.findOne({ + where: { type: "acmeAccount", subtype: "letsencrypt", userId }, + }); + if (!existingAccess) { + //@ts-ignore + user.needInitAccount = true; + } } + return this.ok(user); } @@ -146,8 +150,7 @@ export class MineController extends BaseController { @Post("/accountInit", { description: Constants.per.authOnly, summary: "初始化Let's Encrypt ACME账号和邮件通知" }) public async accountInit(@Body("email") email?: string) { - const { projectId, userId } = await this.getProjectUserIdWrite(); - + let userId = this.getUserId(); let userEmail = email; let user: any = null; if (!userEmail) { @@ -169,10 +172,10 @@ export class MineController extends BaseController { await this.emailService.add(userId, userEmail); - await this.notificationService.getOrCreateDefault(userEmail, userId, projectId); + await this.notificationService.getOrCreateDefault(userEmail, userId); const getAccessById = this.accessService.getById.bind(this.accessService); - const accessGetter = new AccessGetter(userId, projectId, getAccessById); + const accessGetter = new AccessGetter(userId, undefined, getAccessById); const accessContext = { http, logger, @@ -187,7 +190,7 @@ export class MineController extends BaseController { type: "acmeAccount", name: "Let's Encrypt", userId, - projectId, + projectId:undefined, setting: JSON.stringify({ caType: "letsencrypt", email: userEmail,