mirror of
https://github.com/certd/certd.git
synced 2026-04-27 15:17:24 +08:00
chore: 默认密码登录
This commit is contained in:
@@ -21,6 +21,7 @@ export class SysPublicSettings extends BaseSettings {
|
|||||||
usernameRegisterEnabled = true;
|
usernameRegisterEnabled = true;
|
||||||
mobileRegisterEnabled = false;
|
mobileRegisterEnabled = false;
|
||||||
smsLoginEnabled = false;
|
smsLoginEnabled = false;
|
||||||
|
useSmsLoginDefault = true;
|
||||||
emailRegisterEnabled = false;
|
emailRegisterEnabled = false;
|
||||||
selfServicePasswordRetrievalEnabled = false;
|
selfServicePasswordRetrievalEnabled = false;
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ export default {
|
|||||||
alignLeft: "Align Left",
|
alignLeft: "Align Left",
|
||||||
alignRight: "Align Right",
|
alignRight: "Align Right",
|
||||||
},
|
},
|
||||||
|
loginType: {
|
||||||
|
password: "Password Login",
|
||||||
|
sms: "Mobile Login",
|
||||||
|
},
|
||||||
usernamePlaceholder: "Please enter username/email/phone number",
|
usernamePlaceholder: "Please enter username/email/phone number",
|
||||||
passwordPlaceholder: "Please enter your password",
|
passwordPlaceholder: "Please enter your password",
|
||||||
mobilePlaceholder: "Please enter your mobile number",
|
mobilePlaceholder: "Please enter your mobile number",
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ export default {
|
|||||||
alignLeft: "居左",
|
alignLeft: "居左",
|
||||||
alignRight: "居右",
|
alignRight: "居右",
|
||||||
},
|
},
|
||||||
|
loginType: {
|
||||||
|
password: "密码登录",
|
||||||
|
sms: "手机号登录",
|
||||||
|
},
|
||||||
usernamePlaceholder: "请输入用户名/邮箱/手机号",
|
usernamePlaceholder: "请输入用户名/邮箱/手机号",
|
||||||
passwordPlaceholder: "请输入密码",
|
passwordPlaceholder: "请输入密码",
|
||||||
mobilePlaceholder: "请输入手机号",
|
mobilePlaceholder: "请输入手机号",
|
||||||
|
|||||||
@@ -620,6 +620,7 @@ export default {
|
|||||||
proFeature: "专业版功能",
|
proFeature: "专业版功能",
|
||||||
emailServerSetup: "设置邮箱服务器",
|
emailServerSetup: "设置邮箱服务器",
|
||||||
enableSmsLoginRegister: "开启手机号登录、注册",
|
enableSmsLoginRegister: "开启手机号登录、注册",
|
||||||
|
defaultLoginType: "默认登录方式",
|
||||||
commFeature: "商业版功能",
|
commFeature: "商业版功能",
|
||||||
smsProvider: "短信提供商",
|
smsProvider: "短信提供商",
|
||||||
aliyunSms: "阿里云短信",
|
aliyunSms: "阿里云短信",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export type SysPublicSetting = {
|
|||||||
emailRegisterEnabled?: boolean;
|
emailRegisterEnabled?: boolean;
|
||||||
passwordLoginEnabled?: boolean;
|
passwordLoginEnabled?: boolean;
|
||||||
smsLoginEnabled?: boolean;
|
smsLoginEnabled?: boolean;
|
||||||
|
defaultLoginType?: string;
|
||||||
selfServicePasswordRetrievalEnabled?: boolean;
|
selfServicePasswordRetrievalEnabled?: boolean;
|
||||||
|
|
||||||
limitUserPipelineCount?: number;
|
limitUserPipelineCount?: number;
|
||||||
|
|||||||
@@ -4,25 +4,6 @@
|
|||||||
<!-- <div class="login-title">登录</div>-->
|
<!-- <div class="login-title">登录</div>-->
|
||||||
<template v-if="!isOauthOnly">
|
<template v-if="!isOauthOnly">
|
||||||
<a-tabs v-model:active-key="formState.loginType" :tab-bar-style="{ textAlign: 'center', borderBottom: 'unset' }">
|
<a-tabs v-model:active-key="formState.loginType" :tab-bar-style="{ textAlign: 'center', borderBottom: 'unset' }">
|
||||||
<a-tab-pane v-if="sysPublicSettings.smsLoginEnabled === true" key="sms" :tab="t('authentication.smsTab')">
|
|
||||||
<template v-if="formState.loginType === 'sms'">
|
|
||||||
<a-form-item has-feedback name="mobile" :rules="rules.mobile">
|
|
||||||
<a-input v-model:value="formState.mobile" :placeholder="t('authentication.mobilePlaceholder')" autocomplete="off">
|
|
||||||
<template #prefix>
|
|
||||||
<fs-icon icon="ion:phone-portrait-outline"></fs-icon>
|
|
||||||
</template>
|
|
||||||
</a-input>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item has-feedback name="smsCaptcha">
|
|
||||||
<CaptchaInput v-model:model-value="formState.smsCaptcha" @keydown.enter="handleFinish"></CaptchaInput>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item name="smsCode" :rules="rules.smsCode">
|
|
||||||
<sms-code v-model:value="formState.smsCode" :captcha="formState.smsCaptcha" :mobile="formState.mobile" :phone-code="formState.phoneCode" @error="formState.smsCaptcha = null" />
|
|
||||||
</a-form-item>
|
|
||||||
</template>
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="password" :tab="t('authentication.passwordTab')" :disabled="sysPublicSettings.passwordLoginEnabled !== true">
|
<a-tab-pane key="password" :tab="t('authentication.passwordTab')" :disabled="sysPublicSettings.passwordLoginEnabled !== true">
|
||||||
<template v-if="formState.loginType === 'password'">
|
<template v-if="formState.loginType === 'password'">
|
||||||
<!-- <div class="login-title">登录</div>-->
|
<!-- <div class="login-title">登录</div>-->
|
||||||
@@ -46,6 +27,25 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
<a-tab-pane v-if="sysPublicSettings.smsLoginEnabled === true" key="sms" :tab="t('authentication.smsTab')">
|
||||||
|
<template v-if="formState.loginType === 'sms'">
|
||||||
|
<a-form-item has-feedback name="mobile" :rules="rules.mobile">
|
||||||
|
<a-input v-model:value="formState.mobile" :placeholder="t('authentication.mobilePlaceholder')" autocomplete="off">
|
||||||
|
<template #prefix>
|
||||||
|
<fs-icon icon="ion:phone-portrait-outline"></fs-icon>
|
||||||
|
</template>
|
||||||
|
</a-input>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item has-feedback name="smsCaptcha">
|
||||||
|
<CaptchaInput v-model:model-value="formState.smsCaptcha" @keydown.enter="handleFinish"></CaptchaInput>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item name="smsCode" :rules="rules.smsCode">
|
||||||
|
<sms-code v-model:value="formState.smsCode" :captcha="formState.smsCaptcha" :mobile="formState.mobile" :phone-code="formState.phoneCode" @error="formState.smsCaptcha = null" />
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button type="primary" size="large" html-type="button" :loading="loading" class="login-button" @click="handleFinish">
|
<a-button type="primary" size="large" html-type="button" :loading="loading" class="login-button" @click="handleFinish">
|
||||||
@@ -120,12 +120,18 @@ export default defineComponent({
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const settingStore = useSettingStore();
|
const settingStore = useSettingStore();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
let defaultLoginType = settingStore.sysPublic.defaultLoginType || "password";
|
||||||
|
if (defaultLoginType === "sms") {
|
||||||
|
if (!settingStore.sysPublic.smsLoginEnabled || !settingStore.isComm) {
|
||||||
|
defaultLoginType = "password";
|
||||||
|
}
|
||||||
|
}
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
username: "",
|
username: "",
|
||||||
phoneCode: "86",
|
phoneCode: "86",
|
||||||
mobile: "",
|
mobile: "",
|
||||||
password: "",
|
password: "",
|
||||||
loginType: urlLoginType || settingStore.sysPublic.smsLoginEnabled ? "sms" : "password", //password
|
loginType: urlLoginType || settingStore.sysPublic.defaultLoginType, //password
|
||||||
smsCode: "",
|
smsCode: "",
|
||||||
captcha: null,
|
captcha: null,
|
||||||
smsCaptcha: null,
|
smsCaptcha: null,
|
||||||
|
|||||||
@@ -28,6 +28,11 @@
|
|||||||
<router-link to="/sys/settings/email">{{ t("certd.emailServerSetup") }}</router-link>
|
<router-link to="/sys/settings/email">{{ t("certd.emailServerSetup") }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item :label="t('certd.defaultLoginType')" :name="['public', 'defaultLoginType']" required>
|
||||||
|
<div class="flex-o">
|
||||||
|
<a-radio-group v-model:value="formState.public.defaultLoginType" :options="loginTypeOptions" :title="t('certd.commFeature')" />
|
||||||
|
</div>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item :label="t('certd.enableSmsLoginRegister')" :name="['public', 'smsLoginEnabled']">
|
<a-form-item :label="t('certd.enableSmsLoginRegister')" :name="['public', 'smsLoginEnabled']">
|
||||||
<div class="flex-o">
|
<div class="flex-o">
|
||||||
<a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm" :title="t('certd.commFeature')" />
|
<a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm" :title="t('certd.commFeature')" />
|
||||||
@@ -65,7 +70,7 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { notification } from "ant-design-vue";
|
import { notification } from "ant-design-vue";
|
||||||
import { merge } from "lodash-es";
|
import { merge } from "lodash-es";
|
||||||
import { reactive, ref, Ref } from "vue";
|
import { computed, reactive, ref, Ref } from "vue";
|
||||||
import { useSettingStore } from "/@/store/settings";
|
import { useSettingStore } from "/@/store/settings";
|
||||||
import * as api from "/@/views/sys/settings/api";
|
import * as api from "/@/views/sys/settings/api";
|
||||||
import { SysSettings } from "/@/views/sys/settings/api";
|
import { SysSettings } from "/@/views/sys/settings/api";
|
||||||
@@ -187,6 +192,18 @@ const onFinish = async (form: any) => {
|
|||||||
saveLoading.value = false;
|
saveLoading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loginTypeOptions = computed(() => [
|
||||||
|
{
|
||||||
|
label: t("authentication.loginType.password"),
|
||||||
|
value: "password",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t("authentication.loginType.sms"),
|
||||||
|
value: "sms",
|
||||||
|
disabled: !formState.public.smsLoginEnabled,
|
||||||
|
},
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.sys-settings-register {
|
.sys-settings-register {
|
||||||
|
|||||||
Reference in New Issue
Block a user