You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by jo...@apache.org on 2019/12/11 06:28:32 UTC

[incubator-dolphinscheduler] branch dev updated: Password verification and v-for add key (#1440)

This is an automated email from the ASF dual-hosted git repository.

journey pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 446adb2  Password verification and v-for add key (#1440)
446adb2 is described below

commit 446adb24858868a19ba4e948a85c34a232958ad6
Author: break60 <79...@qq.com>
AuthorDate: Wed Dec 11 14:28:23 2019 +0800

    Password verification and v-for add key (#1440)
---
 .../pages/index/_source/taskCtatusCount.vue        |  2 +-
 .../security/pages/users/_source/createUser.vue    | 25 ++++++++++++++++-----
 .../pages/user/pages/password/_source/info.vue     | 26 +++-------------------
 .../src/js/module/components/nav/nav.vue           |  2 +-
 .../components/secondaryMenu/secondaryMenu.vue     |  2 +-
 .../src/js/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 928852d..3e56c34 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 @@
                 <th>{{$t('Number')}}</th>
                 <th>{{$t('State')}}</th>
               </tr>
-              <tr v-for="(item,$index) in taskCtatusList">
+              <tr v-for="(item,$index) in taskCtatusList" :key="$index">
                 <td><span>{{$index+1}}</span></td>
                 <td>
                   <span>
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 fb56c32..926a29a 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 391c982..af296c9 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 b29b172..2c4038a 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">
         <div class="lrns-list">
-          <a href="javascript:" @click="_toggleLanguage(item.code)" v-for="(item,$index) in localeList"><span>{{item.name}}</span></a>
+          <a href="javascript:" @click="_toggleLanguage(item.code)" v-for="(item,$index) in localeList" :key="$index"><span>{{item.name}}</span></a>
         </div>
         <div class="login-model" slot="reference">
           <span>{{activeLocale.name}}</span>
diff --git a/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue b/dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue
index 8c09bfb..9a491fc 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 @@
       <a href="javascript:" class="tog-close" @click="_toggleMenu" v-if="!isTogHide"></a>
       <a href="javascript:" class="tog-open" @click="_toggleMenu" v-if="isTogHide"></a>
     </div>
-    <div class="leven-1" v-for="(item,$index) in menuList">
+    <div class="leven-1" v-for="(item,$index) in menuList" :key="$index">
       <div v-if="item.disabled">
         <template v-if="item.path">
           <router-link :to="{ name: item.path}">
diff --git a/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue b/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
index c9f8537..3e07a94 100644
--- a/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
+++ b/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
@@ -42,7 +42,7 @@
           </div>-->
           <div class="scrollbar tf-content">
             <ul>
-              <li v-for="(item,$index) in sourceList" :key="item.id" @click="_ckSource(item)">
+              <li v-for="(item,$index) in sourceList" :key="$index" @click="_ckSource(item)">
                 <span :title="item.name">{{item.name}}</span>
                 <a href="javascript:"></a>
               </li>
@@ -68,7 +68,7 @@
           </div>-->
           <div class="scrollbar tf-content">
             <ul>
-              <li v-for="(item,$index) in targetList" :key="item.id" @click="_ckTarget(item)"><span :title="item.name">{{item.name}}</span></li>
+              <li v-for="(item,$index) in targetList" :key="$index" @click="_ckTarget(item)"><span :title="item.name">{{item.name}}</span></li>
             </ul>
           </div>
         </div>
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 041704d..fb87146 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -20,6 +20,7 @@ export default {
   'Please enter user name': 'Please enter user name',
   'Password': 'Password',
   'Please enter your password': 'Please enter your password',
+  'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22': 'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22',
   'Login': 'Login',
   'Home': 'Home',
   'Failed to create node to save': 'Failed to create node to save',
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 3e6d7e6..11fd094 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -20,6 +20,7 @@ export default {
   'Please enter user name': '请输入用户名',
   'Password': '密码',
   'Please enter your password': '请输入密码',
+  'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22': '密码至少包含数字,字母和字符的两种组合,长度在6-22之间',
   'Login': '登录',
   'Home': '首页',
   'Failed to create node to save': '未创建节点保存失败',