Showing
4 changed files
with
12 additions
and
0 deletions
| @@ -301,4 +301,5 @@ export default { | @@ -301,4 +301,5 @@ export default { | ||
| 301 | channelSynchronizedMessageText: | 301 | channelSynchronizedMessageText: |
| 302 | 'The channel has been synchronized. Please refresh later to view the results', | 302 | 'The channel has been synchronized. Please refresh later to view the results', |
| 303 | stopped: 'Stopped', | 303 | stopped: 'Stopped', |
| 304 | + specialCharactersError: 'Cannot input special characters', | ||
| 304 | }; | 305 | }; |
| @@ -301,4 +301,5 @@ export default { | @@ -301,4 +301,5 @@ export default { | ||
| 301 | modifiedDeviceCredentials: '修改设备凭证成功', | 301 | modifiedDeviceCredentials: '修改设备凭证成功', |
| 302 | channelSynchronizedMessageText: '通道已同步,请稍后刷新查看结果', | 302 | channelSynchronizedMessageText: '通道已同步,请稍后刷新查看结果', |
| 303 | stopped: '已停止', | 303 | stopped: '已停止', |
| 304 | + specialCharactersError: '不能输入特殊字符', | ||
| 304 | }; | 305 | }; |
| @@ -444,3 +444,7 @@ export const MediaTypeValidate: Rule[] = [ | @@ -444,3 +444,7 @@ export const MediaTypeValidate: Rule[] = [ | ||
| 444 | 444 | ||
| 445 | export const ipRegex = | 445 | export const ipRegex = |
| 446 | /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; | 446 | /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
| 447 | + | ||
| 448 | +// 不能输入特殊字符 | ||
| 449 | +export const specialCharactersRegex = | ||
| 450 | + /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·!#¥(——):;“”‘、,|《。》?、【】[\]]/; |
| @@ -46,6 +46,7 @@ | @@ -46,6 +46,7 @@ | ||
| 46 | import { buildUUID, randomString } from '/@/utils/uuid'; | 46 | import { buildUUID, randomString } from '/@/utils/uuid'; |
| 47 | import { ReloadOutlined } from '@ant-design/icons-vue'; | 47 | import { ReloadOutlined } from '@ant-design/icons-vue'; |
| 48 | import { useI18n } from '/@/hooks/web/useI18n'; | 48 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 49 | + import { specialCharactersRegex } from '/@/utils/rules'; | ||
| 49 | export default defineComponent({ | 50 | export default defineComponent({ |
| 50 | components: { | 51 | components: { |
| 51 | BasicModal, | 52 | BasicModal, |
| @@ -229,6 +230,11 @@ | @@ -229,6 +230,11 @@ | ||
| 229 | ? field.publicKey | 230 | ? field.publicKey |
| 230 | : null, | 231 | : null, |
| 231 | }; | 232 | }; |
| 233 | + // tcp的访问令牌不能输入特殊字符 | ||
| 234 | + const tcpLimitInputSpecialCharacters = specialCharactersRegex.test(editData?.credentialsId); | ||
| 235 | + if (tcpLimitInputSpecialCharacters) | ||
| 236 | + return createMessage.warning(t('common.specialCharactersError')); | ||
| 237 | + // | ||
| 232 | saveDeviceToken(editData) | 238 | saveDeviceToken(editData) |
| 233 | .then((res) => { | 239 | .then((res) => { |
| 234 | if (!res) return; | 240 | if (!res) return; |