|
|
@ -22,28 +22,23 @@
|
|
|
|
<li>Authenticator</li>
|
|
|
|
<li>Authenticator</li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="$t('setting.mfaTypeOption')">
|
|
|
|
<el-form-item :label="$t('setting.mfaHelper2')">
|
|
|
|
<el-radio-group v-model="mode" @change="form.secret = ''">
|
|
|
|
|
|
|
|
<el-radio label="scan">{{ $t('setting.qrCode') }}</el-radio>
|
|
|
|
|
|
|
|
<el-radio label="input">{{ $t('setting.manualInput') }}</el-radio>
|
|
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item :label="$t('setting.mfaHelper2')" v-if="mode === 'scan'">
|
|
|
|
|
|
|
|
<el-image style="width: 120px; height: 120px" :src="qrImage" />
|
|
|
|
<el-image style="width: 120px; height: 120px" :src="qrImage" />
|
|
|
|
</el-form-item>
|
|
|
|
<span class="input-help">
|
|
|
|
<el-form-item
|
|
|
|
<span style="float: left">{{ $t('setting.secret') }}: {{ form.secret }}</span>
|
|
|
|
:label="$t('setting.mfaSecret')"
|
|
|
|
<div style="float: left; margin-top: 2px">
|
|
|
|
v-if="mode === 'input'"
|
|
|
|
<el-icon
|
|
|
|
prop="secret"
|
|
|
|
color="#409EFC"
|
|
|
|
:rules="Rules.requiredInput"
|
|
|
|
style="cursor: pointer; margin-left: 10px"
|
|
|
|
|
|
|
|
:size="18"
|
|
|
|
|
|
|
|
@click="onCopy()"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-input v-model="form.secret"></el-input>
|
|
|
|
<DocumentCopy />
|
|
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item
|
|
|
|
<el-form-item :label="$t('setting.mfaCode')" prop="code" :rules="Rules.requiredInput">
|
|
|
|
:label="mode === 'scan' ? $t('setting.mfaHelper3') : $t('setting.mfaCode')"
|
|
|
|
|
|
|
|
prop="code"
|
|
|
|
|
|
|
|
:rules="Rules.requiredInput"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-input v-model="form.code"></el-input>
|
|
|
|
<el-input v-model="form.code"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
@ -70,7 +65,6 @@ import { FormInstance } from 'element-plus';
|
|
|
|
|
|
|
|
|
|
|
|
const loading = ref();
|
|
|
|
const loading = ref();
|
|
|
|
const qrImage = ref();
|
|
|
|
const qrImage = ref();
|
|
|
|
const mode = ref('scan');
|
|
|
|
|
|
|
|
const drawerVisiable = ref();
|
|
|
|
const drawerVisiable = ref();
|
|
|
|
const formRef = ref();
|
|
|
|
const formRef = ref();
|
|
|
|
|
|
|
|
|
|
|
@ -85,6 +79,16 @@ const acceptParams = (): void => {
|
|
|
|
drawerVisiable.value = true;
|
|
|
|
drawerVisiable.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onCopy = () => {
|
|
|
|
|
|
|
|
let input = document.createElement('input');
|
|
|
|
|
|
|
|
input.value = form.secret;
|
|
|
|
|
|
|
|
document.body.appendChild(input);
|
|
|
|
|
|
|
|
input.select();
|
|
|
|
|
|
|
|
document.execCommand('Copy');
|
|
|
|
|
|
|
|
document.body.removeChild(input);
|
|
|
|
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.copySuccess'));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const loadMfaCode = async () => {
|
|
|
|
const loadMfaCode = async () => {
|
|
|
|
const res = await getMFA();
|
|
|
|
const res = await getMFA();
|
|
|
|
form.secret = res.data.secret;
|
|
|
|
form.secret = res.data.secret;
|
|
|
|