diff --git a/packages/libs/lib-server/src/system/settings/service/models.ts b/packages/libs/lib-server/src/system/settings/service/models.ts
index 7ef22fc5..05daa08a 100644
--- a/packages/libs/lib-server/src/system/settings/service/models.ts
+++ b/packages/libs/lib-server/src/system/settings/service/models.ts
@@ -17,7 +17,7 @@ export class SysPublicSettings extends BaseSettings {
registerEnabled = false;
passwordLoginEnabled = true;
- usernameRegisterEnabled = false;
+ usernameRegisterEnabled = true;
mobileRegisterEnabled = false;
smsLoginEnabled = false;
emailRegisterEnabled = false;
@@ -25,9 +25,6 @@ export class SysPublicSettings extends BaseSettings {
limitUserPipelineCount = 0;
managerOtherUserPipeline = false;
icpNo?: string;
- defaultCron?: string;
- defaultNotification?: number;
- // triggerOnStartup = false;
}
export class SysPrivateSettings extends BaseSettings {
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/index.vue
index e1d9b9aa..aa71ab5a 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/index.vue
+++ b/packages/ui/certd-client/src/views/certd/pipeline/index.vue
@@ -28,8 +28,7 @@ import PiCertdForm from "./certd-form/index.vue";
import ChangeGroup from "./components/change-group.vue";
import { Modal, notification } from "ant-design-vue";
import * as api from "./api";
-import { useSettingStore } from "/@/store/modules/settings";
-import { mitter } from "/@/utils/util.mitt";
+
defineOptions({
name: "PipelineManager"
});
@@ -60,6 +59,7 @@ onActivated(async () => {
function groupChanged() {
crudExpose.doRefresh();
+ selectedRowKeys.value = [];
}
function batchDelete() {
Modal.confirm({
diff --git a/packages/ui/certd-client/src/views/framework/login/index.vue b/packages/ui/certd-client/src/views/framework/login/index.vue
index ad53187e..a94dfc99 100644
--- a/packages/ui/certd-client/src/views/framework/login/index.vue
+++ b/packages/ui/certd-client/src/views/framework/login/index.vue
@@ -60,7 +60,7 @@
- 注册
+ 注册
@@ -149,6 +149,10 @@ export default defineComponent({
const isLoginError = ref();
const sysPublicSettings = settingStore.getSysPublic;
+
+ function hasRegisterTypeEnabled() {
+ return sysPublicSettings.registerEnabled && (sysPublicSettings.usernameRegisterEnabled || sysPublicSettings.emailRegisterEnabled);
+ }
return {
loading,
formState,
@@ -159,7 +163,8 @@ export default defineComponent({
handleFinish,
resetForm,
isLoginError,
- sysPublicSettings
+ sysPublicSettings,
+ hasRegisterTypeEnabled
};
}
});
diff --git a/packages/ui/certd-client/src/views/framework/register/index.vue b/packages/ui/certd-client/src/views/framework/register/index.vue
index fd4b20d5..2c983185 100644
--- a/packages/ui/certd-client/src/views/framework/register/index.vue
+++ b/packages/ui/certd-client/src/views/framework/register/index.vue
@@ -12,7 +12,7 @@
@finish-failed="handleFinishFailed"
>
-
+
@@ -40,7 +40,7 @@
-
+
@@ -91,11 +91,23 @@ import { useUserStore } from "/src/store/modules/user";
import { utils } from "@fast-crud/fast-crud";
import ImageCode from "/@/views/framework/login/image-code.vue";
import EmailCode from "./email-code.vue";
+import { useSettingStore } from "/@/store/modules/settings";
+import { notification } from "ant-design-vue";
export default defineComponent({
name: "RegisterPage",
components: { EmailCode, ImageCode },
setup() {
- const registerType = ref("username");
+ const settingsStore = useSettingStore();
+ const registerType = ref("email");
+ if (!settingsStore.sysPublic.emailRegisterEnabled) {
+ registerType.value = "username";
+ if (!settingsStore.sysPublic.usernameRegisterEnabled) {
+ registerType.value = "";
+ notification.error({
+ message: "没有启用任何一种注册方式"
+ });
+ }
+ }
const userStore = useUserStore();
const formRef = ref();
const formState: any = reactive({
@@ -217,7 +229,8 @@ export default defineComponent({
handleFinishFailed,
handleFinish,
resetForm,
- registerType
+ registerType,
+ settingsStore
};
}
});
diff --git a/packages/ui/certd-server/db/migration-pg/v10014__notification_default.sql b/packages/ui/certd-server/db/migration-pg/v10014__notification_default.sql
new file mode 100644
index 00000000..246fa40c
--- /dev/null
+++ b/packages/ui/certd-server/db/migration-pg/v10014__notification_default.sql
@@ -0,0 +1 @@
+ALTER TABLE pi_notification ADD COLUMN is_default boolean DEFAULT (false);
diff --git a/packages/ui/certd-server/db/migration-pg/v10015__pipeline_group.sql b/packages/ui/certd-server/db/migration-pg/v10015__pipeline_group.sql
new file mode 100644
index 00000000..70900428
--- /dev/null
+++ b/packages/ui/certd-server/db/migration-pg/v10015__pipeline_group.sql
@@ -0,0 +1,13 @@
+CREATE TABLE "pi_pipeline_group"
+(
+ "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ "user_id" bigint NOT NULL,
+ "name" varchar(100) NOT NULL,
+ "icon" varchar(100),
+ "favorite" boolean NOT NULL DEFAULT (false),
+ "create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
+ "update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
+);
+
+ALTER TABLE pi_pipeline
+ ADD COLUMN group_id bigint;
diff --git a/packages/ui/certd-server/src/config/config.default.ts b/packages/ui/certd-server/src/config/config.default.ts
index c1cb967a..c5fa3ff7 100644
--- a/packages/ui/certd-server/src/config/config.default.ts
+++ b/packages/ui/certd-server/src/config/config.default.ts
@@ -71,7 +71,7 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
- logging: true,
+ logging: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
diff --git a/packages/ui/certd-server/src/modules/basic/service/code-service.ts b/packages/ui/certd-server/src/modules/basic/service/code-service.ts
index 2b392312..db678bb0 100644
--- a/packages/ui/certd-server/src/modules/basic/service/code-service.ts
+++ b/packages/ui/certd-server/src/modules/basic/service/code-service.ts
@@ -24,7 +24,6 @@ export class CodeService {
/**
*/
async generateCaptcha(randomStr) {
- console.assert(randomStr < 10, 'randomStr 过长');
const svgCaptcha = await import('svg-captcha');
const c = svgCaptcha.create();
//{data: '', text: 'abcd'}
@@ -57,8 +56,12 @@ export class CodeService {
/**
*/
async sendSmsCode(phoneCode = '86', mobile: string, randomStr: string) {
- console.assert(phoneCode != null && mobile != null, '手机号不能为空');
- console.assert(randomStr != null, 'randomStr不能为空');
+ if (mobile != null) {
+ throw new Error('手机号不能为空');
+ }
+ if (!randomStr) {
+ throw new Error('randomStr不能为空');
+ }
const sysSettings = await this.sysSettingsService.getPrivateSettings();
if (!sysSettings.sms?.config?.accessId) {
@@ -89,8 +92,12 @@ export class CodeService {
/**
*/
async sendEmailCode(email: string, randomStr: string) {
- console.assert(!email, 'Email不能为空');
- console.assert(!randomStr, 'randomStr不能为空');
+ if (!email) {
+ throw new Error('Email不能为空');
+ }
+ if (!randomStr) {
+ throw new Error('randomStr不能为空');
+ }
const code = randomNumber(4);
await this.emailService.send({
diff --git a/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts b/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts
index 81130a95..102fc2b6 100644
--- a/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts
+++ b/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts
@@ -76,7 +76,7 @@ export class NotificationService extends BaseService {
},
});
if (!res) {
- throw new ValidateException('默认通知配置不存在');
+ return null;
}
return this.buildNotificationInstanceConfig(res);
}