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

This commit is contained in:
break60 2019-12-11 14:28:23 +08:00 committed by qiaozhanwei
parent 44d780d803
commit 446adb2485
8 changed files with 30 additions and 33 deletions

View File

@ -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>

View File

@ -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 = ''
}
}
}
},

View File

@ -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

View File

@ -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>

View File

@ -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}">

View File

@ -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>

View File

@ -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',

View File

@ -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': '未创建节点保存失败',