Commit 1bcc87a20cf7ca13d235a2ef9e4a20513ed6f57e
Merge branch 'fix/front/10-30/2024' into 'main_dev'
perf: 优化tcp设备凭证不能输入特殊字符 See merge request yunteng/thingskit-front!1521
Showing
4 changed files
with
12 additions
and
0 deletions
... | ... | @@ -444,3 +444,7 @@ export const MediaTypeValidate: Rule[] = [ |
444 | 444 | |
445 | 445 | export const ipRegex = |
446 | 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 | 46 | import { buildUUID, randomString } from '/@/utils/uuid'; |
47 | 47 | import { ReloadOutlined } from '@ant-design/icons-vue'; |
48 | 48 | import { useI18n } from '/@/hooks/web/useI18n'; |
49 | + import { specialCharactersRegex } from '/@/utils/rules'; | |
49 | 50 | export default defineComponent({ |
50 | 51 | components: { |
51 | 52 | BasicModal, |
... | ... | @@ -229,6 +230,11 @@ |
229 | 230 | ? field.publicKey |
230 | 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 | 238 | saveDeviceToken(editData) |
233 | 239 | .then((res) => { |
234 | 240 | if (!res) return; | ... | ... |