Skip to content

Commit

Permalink
fix(settings): add opt for allow_anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Nov 15, 2024
1 parent 0a11e63 commit f678637
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/i18n/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export default {
en: 'The action when acl check reject current operation',
},
allow_anonymous: {
zh: '如果未加载身份验证插件,则默认情况下允许匿名身份验证。建议在生产部署中禁用该选项!',
en: 'Allow anonymous authentication by default if no auth plugins loaded. Disable the option in production deployment',
zh: '是否启用匿名认证,可能导致未知客户端成功登录,默认启用,建议在生产部署中禁用此选项!配置为 "false_quick_deny" 意味着快速拒绝匿名(没有用户名)的客户端,从而跳过认证后端的检查。',
en: 'Whether to enable anonymous authentication, it may cause unknown clients to login successfully. Enabled by default, it\'s recommended to disable this option in production deployment! Configured to "false_quick_deny" means quick deny of anonymous clients (without username). So the auth backend checks can be skipped.',
},
crl_cache_http_timeout: {
zh: '获取 CRL 时 HTTP 请求的超时限制。该参数适用于所有启用了 CRL 检查的监听器。',
Expand Down
8 changes: 7 additions & 1 deletion src/views/Settings/BaseSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</template>

<script>
import _ from 'lodash'
import { loadConfig, updateConfig } from '../../api/settings'
import ConfigForm from './components/ConfigForm'
import { allOptions } from '@/common/settingsData'
Expand All @@ -43,7 +44,12 @@ export default {
computed: {
allOptions() {
return allOptions
const ret = _.cloneDeep(allOptions)
ret.allowAnonymousOptions = [
..._.cloneDeep(allOptions.boolOptions),
{ label: 'false_quick_deny', value: 'false_quick_deny' },
]
return ret
},
},
Expand Down
9 changes: 8 additions & 1 deletion src/views/Settings/components/ConfigForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
<template slot="label">
<span v-html="key === '' ? 'listener_on' : key"></span>
</template>
<template v-if="deepRecord[key] === 'true' || deepRecord[key] === 'false'">
<template v-if="key === 'allow_anonymous' && allowAnonymousOptions">
<emq-select v-model="recordConfig[key]" :field="{ options: allowAnonymousOptions }"> </emq-select>
</template>
<template v-else-if="deepRecord[key] === 'true' || deepRecord[key] === 'false'">
<emq-select v-model="recordConfig[key]" :field="{ options: boolOptions }"> </emq-select>
</template>

Expand Down Expand Up @@ -127,6 +130,10 @@ export default {
type: Array,
default: () => [],
},
allowAnonymousOptions: {
type: Array,
default: () => [],
},
labelWidth: {
type: String,
default: '225px',
Expand Down

0 comments on commit f678637

Please sign in to comment.