mirror of https://github.com/certd/certd
chore:
parent
5a607efa9f
commit
2bc3456400
|
@ -17,7 +17,7 @@ export class SysPublicSettings extends BaseSettings {
|
||||||
|
|
||||||
registerEnabled = false;
|
registerEnabled = false;
|
||||||
passwordLoginEnabled = true;
|
passwordLoginEnabled = true;
|
||||||
usernameRegisterEnabled = false;
|
usernameRegisterEnabled = true;
|
||||||
mobileRegisterEnabled = false;
|
mobileRegisterEnabled = false;
|
||||||
smsLoginEnabled = false;
|
smsLoginEnabled = false;
|
||||||
emailRegisterEnabled = false;
|
emailRegisterEnabled = false;
|
||||||
|
@ -25,9 +25,6 @@ export class SysPublicSettings extends BaseSettings {
|
||||||
limitUserPipelineCount = 0;
|
limitUserPipelineCount = 0;
|
||||||
managerOtherUserPipeline = false;
|
managerOtherUserPipeline = false;
|
||||||
icpNo?: string;
|
icpNo?: string;
|
||||||
defaultCron?: string;
|
|
||||||
defaultNotification?: number;
|
|
||||||
// triggerOnStartup = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SysPrivateSettings extends BaseSettings {
|
export class SysPrivateSettings extends BaseSettings {
|
||||||
|
|
|
@ -28,8 +28,7 @@ import PiCertdForm from "./certd-form/index.vue";
|
||||||
import ChangeGroup from "./components/change-group.vue";
|
import ChangeGroup from "./components/change-group.vue";
|
||||||
import { Modal, notification } from "ant-design-vue";
|
import { Modal, notification } from "ant-design-vue";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { useSettingStore } from "/@/store/modules/settings";
|
|
||||||
import { mitter } from "/@/utils/util.mitt";
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "PipelineManager"
|
name: "PipelineManager"
|
||||||
});
|
});
|
||||||
|
@ -60,6 +59,7 @@ onActivated(async () => {
|
||||||
|
|
||||||
function groupChanged() {
|
function groupChanged() {
|
||||||
crudExpose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
}
|
}
|
||||||
function batchDelete() {
|
function batchDelete() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item class="user-login-other">
|
<a-form-item class="user-login-other">
|
||||||
<router-link v-if="sysPublicSettings.registerEnabled" class="register" :to="{ name: 'register' }"> 注册 </router-link>
|
<router-link v-if="hasRegisterTypeEnabled()" class="register" :to="{ name: 'register' }"> 注册 </router-link>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -149,6 +149,10 @@ export default defineComponent({
|
||||||
const isLoginError = ref();
|
const isLoginError = ref();
|
||||||
|
|
||||||
const sysPublicSettings = settingStore.getSysPublic;
|
const sysPublicSettings = settingStore.getSysPublic;
|
||||||
|
|
||||||
|
function hasRegisterTypeEnabled() {
|
||||||
|
return sysPublicSettings.registerEnabled && (sysPublicSettings.usernameRegisterEnabled || sysPublicSettings.emailRegisterEnabled);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
formState,
|
formState,
|
||||||
|
@ -159,7 +163,8 @@ export default defineComponent({
|
||||||
handleFinish,
|
handleFinish,
|
||||||
resetForm,
|
resetForm,
|
||||||
isLoginError,
|
isLoginError,
|
||||||
sysPublicSettings
|
sysPublicSettings,
|
||||||
|
hasRegisterTypeEnabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
@finish-failed="handleFinishFailed"
|
@finish-failed="handleFinishFailed"
|
||||||
>
|
>
|
||||||
<a-tabs v-model:active-key="registerType">
|
<a-tabs v-model:active-key="registerType">
|
||||||
<a-tab-pane key="username" tab="用户名注册">
|
<a-tab-pane key="username" tab="用户名注册" :disabled="!settingsStore.sysPublic.usernameRegisterEnabled">
|
||||||
<template v-if="registerType === 'username'">
|
<template v-if="registerType === 'username'">
|
||||||
<a-form-item required has-feedback name="username" label="用户名" :rules="rules.username">
|
<a-form-item required has-feedback name="username" label="用户名" :rules="rules.username">
|
||||||
<a-input v-model:value="formState.username" placeholder="用户名" size="large" autocomplete="off">
|
<a-input v-model:value="formState.username" placeholder="用户名" size="large" autocomplete="off">
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="email" tab="邮箱注册">
|
<a-tab-pane key="email" tab="邮箱注册" :disabled="!settingsStore.sysPublic.emailRegisterEnabled">
|
||||||
<template v-if="registerType === 'email'">
|
<template v-if="registerType === 'email'">
|
||||||
<a-form-item required has-feedback name="email" label="邮箱">
|
<a-form-item required has-feedback name="email" label="邮箱">
|
||||||
<a-input v-model:value="formState.email" placeholder="邮箱" size="large" autocomplete="off">
|
<a-input v-model:value="formState.email" placeholder="邮箱" size="large" autocomplete="off">
|
||||||
|
@ -91,11 +91,23 @@ import { useUserStore } from "/src/store/modules/user";
|
||||||
import { utils } from "@fast-crud/fast-crud";
|
import { utils } from "@fast-crud/fast-crud";
|
||||||
import ImageCode from "/@/views/framework/login/image-code.vue";
|
import ImageCode from "/@/views/framework/login/image-code.vue";
|
||||||
import EmailCode from "./email-code.vue";
|
import EmailCode from "./email-code.vue";
|
||||||
|
import { useSettingStore } from "/@/store/modules/settings";
|
||||||
|
import { notification } from "ant-design-vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "RegisterPage",
|
name: "RegisterPage",
|
||||||
components: { EmailCode, ImageCode },
|
components: { EmailCode, ImageCode },
|
||||||
setup() {
|
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 userStore = useUserStore();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const formState: any = reactive({
|
const formState: any = reactive({
|
||||||
|
@ -217,7 +229,8 @@ export default defineComponent({
|
||||||
handleFinishFailed,
|
handleFinishFailed,
|
||||||
handleFinish,
|
handleFinish,
|
||||||
resetForm,
|
resetForm,
|
||||||
registerType
|
registerType,
|
||||||
|
settingsStore
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE pi_notification ADD COLUMN is_default boolean DEFAULT (false);
|
|
@ -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;
|
|
@ -71,7 +71,7 @@ const development = {
|
||||||
type: 'better-sqlite3',
|
type: 'better-sqlite3',
|
||||||
database: './data/db.sqlite',
|
database: './data/db.sqlite',
|
||||||
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
|
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
|
||||||
logging: true,
|
logging: false,
|
||||||
|
|
||||||
// 配置实体模型 或者 entities: '/entity',
|
// 配置实体模型 或者 entities: '/entity',
|
||||||
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
|
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
|
||||||
|
|
|
@ -24,7 +24,6 @@ export class CodeService {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async generateCaptcha(randomStr) {
|
async generateCaptcha(randomStr) {
|
||||||
console.assert(randomStr < 10, 'randomStr 过长');
|
|
||||||
const svgCaptcha = await import('svg-captcha');
|
const svgCaptcha = await import('svg-captcha');
|
||||||
const c = svgCaptcha.create();
|
const c = svgCaptcha.create();
|
||||||
//{data: '<svg.../svg>', text: 'abcd'}
|
//{data: '<svg.../svg>', text: 'abcd'}
|
||||||
|
@ -57,8 +56,12 @@ export class CodeService {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async sendSmsCode(phoneCode = '86', mobile: string, randomStr: string) {
|
async sendSmsCode(phoneCode = '86', mobile: string, randomStr: string) {
|
||||||
console.assert(phoneCode != null && mobile != null, '手机号不能为空');
|
if (mobile != null) {
|
||||||
console.assert(randomStr != null, 'randomStr不能为空');
|
throw new Error('手机号不能为空');
|
||||||
|
}
|
||||||
|
if (!randomStr) {
|
||||||
|
throw new Error('randomStr不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
const sysSettings = await this.sysSettingsService.getPrivateSettings();
|
const sysSettings = await this.sysSettingsService.getPrivateSettings();
|
||||||
if (!sysSettings.sms?.config?.accessId) {
|
if (!sysSettings.sms?.config?.accessId) {
|
||||||
|
@ -89,8 +92,12 @@ export class CodeService {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
async sendEmailCode(email: string, randomStr: string) {
|
async sendEmailCode(email: string, randomStr: string) {
|
||||||
console.assert(!email, 'Email不能为空');
|
if (!email) {
|
||||||
console.assert(!randomStr, 'randomStr不能为空');
|
throw new Error('Email不能为空');
|
||||||
|
}
|
||||||
|
if (!randomStr) {
|
||||||
|
throw new Error('randomStr不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
const code = randomNumber(4);
|
const code = randomNumber(4);
|
||||||
await this.emailService.send({
|
await this.emailService.send({
|
||||||
|
|
|
@ -76,7 +76,7 @@ export class NotificationService extends BaseService<NotificationEntity> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new ValidateException('默认通知配置不存在');
|
return null;
|
||||||
}
|
}
|
||||||
return this.buildNotificationInstanceConfig(res);
|
return this.buildNotificationInstanceConfig(res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue