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,