mirror of
https://github.com/jumpserver/lina.git
synced 2026-02-05 08:38:58 +00:00
Compare commits
1 Commits
dev
...
pr@dev@per
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6def93b833 |
53
src/components/Form/FormFields/agreement.vue
Normal file
53
src/components/Form/FormFields/agreement.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-checkbox v-model="iValue">
|
||||
{{ $t('ReadAgreeTo') }}
|
||||
<a href="/core/auth/agreement/" target="_blank" style="color: #409eff">
|
||||
{{ $t('TermsOfService') }}
|
||||
</a>
|
||||
{{ $t('and') }}
|
||||
<a href="/core/auth/privacy/" target="_blank" style="color: #409eff">
|
||||
{{ $t('PrivacyPolicy') }}
|
||||
</a>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
iValue: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
iValue: {
|
||||
handler(v) {
|
||||
this.$emit('input', v)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.iValue = this.value
|
||||
},
|
||||
computed: {
|
||||
iValue: {
|
||||
get() {
|
||||
return this.value
|
||||
},
|
||||
set(v) {
|
||||
this.$emit('update:value', v)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -6,12 +6,14 @@
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import { Required } from '@/components/Form/DataForm/rules'
|
||||
import { PhoneInput } from '@/components/Form/FormFields'
|
||||
import Agreement from '@/components/Form/FormFields/agreement.vue'
|
||||
import store from '@/store'
|
||||
|
||||
export default {
|
||||
name: 'Improvement',
|
||||
components: {
|
||||
GenericCreateUpdatePage
|
||||
GenericCreateUpdatePage,
|
||||
Agreement
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
@@ -26,7 +28,7 @@ export default {
|
||||
[this.$t('Account'), ['username', 'name', 'email']],
|
||||
[this.$t('Authentication'), ['mfa_level', 'public_key']],
|
||||
[this.$t('Other'), ['phone']],
|
||||
[this.$t('TermsAndConditions'), ['terms']]
|
||||
[this.$t('TermsOfService'), ['terms']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
username: {
|
||||
@@ -53,15 +55,14 @@ export default {
|
||||
type: 'textarea',
|
||||
placeholder: 'ssh-rsa AAAA...'
|
||||
},
|
||||
hidden: (formValue) => {
|
||||
hidden: formValue => {
|
||||
return formValue.source !== 'local'
|
||||
},
|
||||
helpText: this.$t('SSHKeyOfProfileSSHUpdatePage')
|
||||
},
|
||||
terms: {
|
||||
label: this.$t('IAgree'),
|
||||
type: 'checkbox',
|
||||
checked: false,
|
||||
label: '',
|
||||
component: Agreement,
|
||||
rules: [Required],
|
||||
helpText: this.$t('MFAOfUserFirstLoginUserGuidePage')
|
||||
}
|
||||
@@ -93,9 +94,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
disableMFAFieldIfNeed(user) {
|
||||
const adminUserIsNeed = (user?.is_superuser || user?.is_org_admin) &&
|
||||
const adminUserIsNeed =
|
||||
(user?.is_superuser || user?.is_org_admin) &&
|
||||
store.getters.publicSettings['SECURITY_MFA_AUTH'] === 2
|
||||
if (store.getters.publicSettings['SECURITY_MFA_AUTH'] === 1 || adminUserIsNeed || user?.mfa_level.value === 2) {
|
||||
if (
|
||||
store.getters.publicSettings['SECURITY_MFA_AUTH'] === 1 ||
|
||||
adminUserIsNeed ||
|
||||
user?.mfa_level.value === 2
|
||||
) {
|
||||
this.fieldsMeta['mfa_level'].disabled = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user