提交 446adb24 编写于 作者: B break60 提交者: qiaozhanwei

Password verification and v-for add key (#1440)

上级 44d780d8
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<th>{{$t('Number')}}</th> <th>{{$t('Number')}}</th>
<th>{{$t('State')}}</th> <th>{{$t('State')}}</th>
</tr> </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>{{$index+1}}</span></td>
<td> <td>
<span> <span>
......
...@@ -150,6 +150,8 @@ ...@@ -150,6 +150,8 @@
// Mobile phone number regular // Mobile phone number regular
let regPhone = /^1(3|4|5|6|7|8)\d{9}$/; // eslint-disable-line 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 // user name
if (!this.userName.replace(/\s*/g,"")) { if (!this.userName.replace(/\s*/g,"")) {
...@@ -157,10 +159,18 @@ ...@@ -157,10 +159,18 @@
return false return false
} }
// password // password
if (!this.userPassword && !this.item) { if (this.userPassword!='' && this.item) {
this.$message.warning(`${i18n.$t('Please enter your password')}`) if(!regPassword.test(this.userPassword)) {
return false 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 // email
if (!this.email) { if (!this.email) {
this.$message.warning(`${i18n.$t('Please enter email')}`) this.$message.warning(`${i18n.$t('Please enter email')}`)
...@@ -184,6 +194,7 @@ ...@@ -184,6 +194,7 @@
_getQueueList () { _getQueueList () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.store.dispatch('security/getQueueList').then(res => { this.store.dispatch('security/getQueueList').then(res => {
this.queueList = _.map(res, v => { this.queueList = _.map(res, v => {
return { return {
id: v.id, id: v.id,
...@@ -223,7 +234,7 @@ ...@@ -223,7 +234,7 @@
userPassword: this.userPassword, userPassword: this.userPassword,
tenantId: this.tenantId, tenantId: this.tenantId,
email: this.email, email: this.email,
queue: this.queueList[this.queueName].code, queue: this.queueList.length>0? _.find(this.queueList, ['id', this.queueName]).code : '',
phone: this.phone phone: this.phone
} }
...@@ -266,7 +277,11 @@ ...@@ -266,7 +277,11 @@
this.email = this.item.email this.email = this.item.email
this.phone = this.item.phone this.phone = this.item.phone
this.tenantId = this.item.tenantId 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 = ''
}
} }
} }
}, },
......
...@@ -104,35 +104,15 @@ ...@@ -104,35 +104,15 @@
* verification * verification
*/ */
_verification () { _verification () {
let regCn = new RegExp('[\\u4E00-\\u9FFF]+', 'g') let regPassword = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?![`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]+$)[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、0-9A-Za-z]{6,22}$/;
// password // password
if (regCn.test(this.userPassword)) { if (!regPassword.test(this.userPassword)) {
this.$message.warning(`${i18n.$t('Password cannot be in Chinese')}`) 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
}
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')}`)
return false return false
} }
// confirm password // 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) { if (this.userPassword !== this.oldUserPassword) {
this.$message.warning(`${i18n.$t('The password is inconsistent with the confirmation password')}`) this.$message.warning(`${i18n.$t('The password is inconsistent with the confirmation password')}`)
return false return false
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
style="width: 80px" style="width: 80px"
trigger="click"> trigger="click">
<div class="lrns-list"> <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>
<div class="login-model" slot="reference"> <div class="login-model" slot="reference">
<span>{{activeLocale.name}}</span> <span>{{activeLocale.name}}</span>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<a href="javascript:" class="tog-close" @click="_toggleMenu" v-if="!isTogHide"></a> <a href="javascript:" class="tog-close" @click="_toggleMenu" v-if="!isTogHide"></a>
<a href="javascript:" class="tog-open" @click="_toggleMenu" v-if="isTogHide"></a> <a href="javascript:" class="tog-open" @click="_toggleMenu" v-if="isTogHide"></a>
</div> </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"> <div v-if="item.disabled">
<template v-if="item.path"> <template v-if="item.path">
<router-link :to="{ name: item.path}"> <router-link :to="{ name: item.path}">
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</div>--> </div>-->
<div class="scrollbar tf-content"> <div class="scrollbar tf-content">
<ul> <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> <span :title="item.name">{{item.name}}</span>
<a href="javascript:"></a> <a href="javascript:"></a>
</li> </li>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</div>--> </div>-->
<div class="scrollbar tf-content"> <div class="scrollbar tf-content">
<ul> <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> </ul>
</div> </div>
</div> </div>
......
...@@ -20,6 +20,7 @@ export default { ...@@ -20,6 +20,7 @@ export default {
'Please enter user name': 'Please enter user name', 'Please enter user name': 'Please enter user name',
'Password': 'Password', 'Password': 'Password',
'Please enter your password': 'Please enter your 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', 'Login': 'Login',
'Home': 'Home', 'Home': 'Home',
'Failed to create node to save': 'Failed to create node to save', 'Failed to create node to save': 'Failed to create node to save',
......
...@@ -20,6 +20,7 @@ export default { ...@@ -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': '密码至少包含数字,字母和字符的两种组合,长度在6-22之间',
'Login': '登录', 'Login': '登录',
'Home': '首页', 'Home': '首页',
'Failed to create node to save': '未创建节点保存失败', 'Failed to create node to save': '未创建节点保存失败',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册