Commit 1bcc87a20cf7ca13d235a2ef9e4a20513ed6f57e

Authored by xp.Huang
2 parents c6aa9023 5a5e690b

Merge branch 'fix/front/10-30/2024' into 'main_dev'

perf: 优化tcp设备凭证不能输入特殊字符

See merge request yunteng/thingskit-front!1521
... ... @@ -301,4 +301,5 @@ export default {
301 301 channelSynchronizedMessageText:
302 302 'The channel has been synchronized. Please refresh later to view the results',
303 303 stopped: 'Stopped',
  304 + specialCharactersError: 'Cannot input special characters',
304 305 };
... ...
... ... @@ -301,4 +301,5 @@ export default {
301 301 modifiedDeviceCredentials: '修改设备凭证成功',
302 302 channelSynchronizedMessageText: '通道已同步,请稍后刷新查看结果',
303 303 stopped: '已停止',
  304 + specialCharactersError: '不能输入特殊字符',
304 305 };
... ...
... ... @@ -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;
... ...