mirror of https://github.com/certd/certd
chore:
parent
5a607efa9f
commit
2bc3456400
|
@ -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 {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</a-form-item>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@finish-failed="handleFinishFailed"
|
||||
>
|
||||
<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'">
|
||||
<a-form-item required has-feedback name="username" label="用户名" :rules="rules.username">
|
||||
<a-input v-model:value="formState.username" placeholder="用户名" size="large" autocomplete="off">
|
||||
|
@ -40,7 +40,7 @@
|
|||
</a-form-item>
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="email" tab="邮箱注册">
|
||||
<a-tab-pane key="email" tab="邮箱注册" :disabled="!settingsStore.sysPublic.emailRegisterEnabled">
|
||||
<template v-if="registerType === 'email'">
|
||||
<a-form-item required has-feedback name="email" label="邮箱">
|
||||
<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 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
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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',
|
||||
database: './data/db.sqlite',
|
||||
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
|
||||
logging: true,
|
||||
logging: false,
|
||||
|
||||
// 配置实体模型 或者 entities: '/entity',
|
||||
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
|
||||
|
|
|
@ -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: '<svg.../svg>', 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({
|
||||
|
|
|
@ -76,7 +76,7 @@ export class NotificationService extends BaseService<NotificationEntity> {
|
|||
},
|
||||
});
|
||||
if (!res) {
|
||||
throw new ValidateException('默认通知配置不存在');
|
||||
return null;
|
||||
}
|
||||
return this.buildNotificationInstanceConfig(res);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue