From bd2569a26f2e3322595e9c61b1164f98d7e47e2a Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 11 Dec 2019 10:31:37 +0800 Subject: [PATCH 01/10] Password verification and v-for add key --- .../pages/index/_source/taskCtatusCount.vue | 2 +- .../pages/users/_source/createUser.vue | 25 ++++++++++++++---- .../user/pages/password/_source/info.vue | 26 +++---------------- .../src/js/module/components/nav/nav.vue | 2 +- .../secondaryMenu/secondaryMenu.vue | 2 +- .../module/components/transfer/resource.vue | 4 +-- .../src/js/module/i18n/locale/en_US.js | 1 + .../src/js/module/i18n/locale/zh_CN.js | 1 + 8 files changed, 30 insertions(+), 33 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue index 928852d44fe6..3e56c344f72d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue @@ -29,7 +29,7 @@ {{$t('Number')}} {{$t('State')}} - + {{$index+1}} diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue index fb56c3268354..926a29a7b205 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue @@ -150,6 +150,8 @@ // Mobile phone number regular let regPhone = /^1(3|4|5|6|7|8)\d{9}$/; // eslint-disable-line + + let regPassword = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?![`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]+$)[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、0-9A-Za-z]{6,22}$/; // user name if (!this.userName.replace(/\s*/g,"")) { @@ -157,10 +159,18 @@ return false } // password - if (!this.userPassword && !this.item) { - this.$message.warning(`${i18n.$t('Please enter your password')}`) - return false + if (this.userPassword!='' && this.item) { + if(!regPassword.test(this.userPassword)) { + this.$message.warning(`${i18n.$t('Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22')}`) + return false + } + } else if(!this.item){ + if(!regPassword.test(this.userPassword)) { + this.$message.warning(`${i18n.$t('Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22')}`) + return false + } } + // email if (!this.email) { this.$message.warning(`${i18n.$t('Please enter email')}`) @@ -184,6 +194,7 @@ _getQueueList () { return new Promise((resolve, reject) => { this.store.dispatch('security/getQueueList').then(res => { + this.queueList = _.map(res, v => { return { id: v.id, @@ -223,7 +234,7 @@ userPassword: this.userPassword, tenantId: this.tenantId, email: this.email, - queue: this.queueList[this.queueName].code, + queue: this.queueList.length>0? _.find(this.queueList, ['id', this.queueName]).code : '', phone: this.phone } @@ -266,7 +277,11 @@ this.email = this.item.email this.phone = this.item.phone this.tenantId = this.item.tenantId - this.queueName = _.find(this.queueList, ['code', this.item.queue]).id + if(this.queueList.length>0) { + this.queueName = _.find(this.queueList, ['code', this.item.queue]).id + } else { + this.queueName = '' + } } } }, diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/user/pages/password/_source/info.vue b/dolphinscheduler-ui/src/js/conf/home/pages/user/pages/password/_source/info.vue index 391c982f7e25..af296c9f283d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/user/pages/password/_source/info.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/user/pages/password/_source/info.vue @@ -104,35 +104,15 @@ * verification */ _verification () { - let regCn = new RegExp('[\\u4E00-\\u9FFF]+', 'g') + let regPassword = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?![`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]+$)[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、0-9A-Za-z]{6,22}$/; // password - if (regCn.test(this.userPassword)) { - this.$message.warning(`${i18n.$t('Password cannot be in Chinese')}`) - return false - } - if (!this.userPassword) { - this.$message.warning(`${i18n.$t('Please enter a password (6-22) character password')}`) - return false - } - if (this.userPassword.length < 6 || this.userPassword.length > 22) { - this.$message.warning(`${i18n.$t('Please enter a password (6-22) character password')}`) + if (!regPassword.test(this.userPassword)) { + this.$message.warning(`${i18n.$t('Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22')}`) return false } // confirm password - if (regCn.test(this.oldUserPassword)) { - this.$message.warning(`${i18n.$t('Confirmation password cannot be in Chinese')}`) - return false - } - if (!this.oldUserPassword) { - this.$message.warning(`${i18n.$t('Please enter a confirmation password (6-22) character password')}`) - return false - } - if (this.oldUserPassword.length < 6 || this.oldUserPassword.length > 22) { - this.$message.warning(`${i18n.$t('Please enter a confirmation password (6-22) character password')}`) - return false - } if (this.userPassword !== this.oldUserPassword) { this.$message.warning(`${i18n.$t('The password is inconsistent with the confirmation password')}`) return false diff --git a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue index b29b172fea31..2c4038ac7322 100644 --- a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue +++ b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue @@ -72,7 +72,7 @@ style="width: 80px" trigger="click">
- {{item.name}} + {{item.name}}
{{activeLocale.name}} diff --git a/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue b/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue index 8c09bfb3262d..9a491fc622bd 100644 --- a/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue +++ b/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue @@ -20,7 +20,7 @@
-
+