feat(user): 修改初始密码并增加密码强度验证
- 将初始密码从"666666"修改为"Jtys@123456"- 在用户修改密码时增加密码强度验证规则 - 弱密码用户登录时提示修改密码 - 优化密码修改逻辑,修改成功后自动登出dev
parent
30dfc667b5
commit
e8293f88d1
|
@ -60,9 +60,6 @@
|
||||||
<el-form-item label="确认密码:" prop="newpassword1">
|
<el-form-item label="确认密码:" prop="newpassword1">
|
||||||
<el-input v-model="userForm.newpassword1" type="password" auto-complete="off" />
|
<el-input v-model="userForm.newpassword1" type="password" auto-complete="off" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="姓名" prop="NAME">
|
|
||||||
<el-input v-model="userForm.NAME" placeholder="这里输入姓名..." />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="邮箱" prop="EMAIL">
|
<el-form-item label="邮箱" prop="EMAIL">
|
||||||
<el-input v-model="userForm.EMAIL" placeholder="这里输入邮箱..." />
|
<el-input v-model="userForm.EMAIL" placeholder="这里输入邮箱..." />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -140,6 +137,7 @@ import Screenfull from '@/components/Screenfull'
|
||||||
import SizeSelect from '@/components/SizeSelect'
|
import SizeSelect from '@/components/SizeSelect'
|
||||||
import { requestFN } from '@/utils/request'
|
import { requestFN } from '@/utils/request'
|
||||||
import { upload } from '@/utils/upload'
|
import { upload } from '@/utils/upload'
|
||||||
|
import { MessageBox } from 'element-ui'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
|
@ -150,8 +148,9 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
const validatePass = (rule, value, callback) => {
|
const validatePass = (rule, value, callback) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
if (value.toString().length < 1 || value.toString().length > 18) {
|
var reg1 = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&*.])[\da-zA-Z~!@#$%^&*.]{8,}$/
|
||||||
callback(new Error('密码长度为6-18位'))
|
if (!reg1.test(value)) {
|
||||||
|
callback(new Error('密码必须是8位以上、必须包含大小写字母、数字、特殊符号'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
|
@ -207,7 +206,6 @@ export default {
|
||||||
photoForm: {},
|
photoForm: {},
|
||||||
userForm: {
|
userForm: {
|
||||||
USERNAME: '',
|
USERNAME: '',
|
||||||
NAME: '',
|
|
||||||
EMAIL: '',
|
EMAIL: '',
|
||||||
newpwd: '',
|
newpwd: '',
|
||||||
newpassword1: ''
|
newpassword1: ''
|
||||||
|
@ -224,7 +222,6 @@ export default {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
userFormRules: {
|
userFormRules: {
|
||||||
NAME: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
|
|
||||||
|
|
||||||
EMAIL: [
|
EMAIL: [
|
||||||
{ required: false, message: '请输入邮箱', trigger: 'blur' },
|
{ required: false, message: '请输入邮箱', trigger: 'blur' },
|
||||||
|
@ -396,7 +393,6 @@ export default {
|
||||||
USERNAME: this.userForm.USERNAME,
|
USERNAME: this.userForm.USERNAME,
|
||||||
// NUMBER:this.userForm.NUMBER,
|
// NUMBER:this.userForm.NUMBER,
|
||||||
PASSWORD: this.userForm.newpwd,
|
PASSWORD: this.userForm.newpwd,
|
||||||
NAME: this.userForm.NAME,
|
|
||||||
PHONE: this.userForm.PHONE,
|
PHONE: this.userForm.PHONE,
|
||||||
EMAIL: this.userForm.EMAIL,
|
EMAIL: this.userForm.EMAIL,
|
||||||
DEPARTMENT_ID: this.DEPARTMENT_ID,
|
DEPARTMENT_ID: this.DEPARTMENT_ID,
|
||||||
|
@ -405,11 +401,22 @@ export default {
|
||||||
BZ: this.userForm.BZ,
|
BZ: this.userForm.BZ,
|
||||||
OPERATIONTYPE: '1' }
|
OPERATIONTYPE: '1' }
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
|
if (this.userForm.newpwd) {
|
||||||
|
MessageBox.alert('密码修改成功,请重新登录!', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
callback: action => {
|
||||||
|
sessionStorage.clear()
|
||||||
|
this.goOut()
|
||||||
|
location.reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
Message({
|
Message({
|
||||||
message: '信息修改成功',
|
message: '信息修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 5 * 1000
|
duration: 5 * 1000
|
||||||
})
|
})
|
||||||
|
}
|
||||||
this.dialogMessageEdit = false
|
this.dialogMessageEdit = false
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,18 +13,75 @@
|
||||||
<el-button type="primary" @click="closeWarn">确 认</el-button>
|
<el-button type="primary" @click="closeWarn">确 认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog :visible.sync="dialogFormEdit" :before-close="handleClose" :append-to-body="true" title="登录的密码强度为弱,请修改密码!" width="600px">
|
||||||
|
<div style="padding:0 40px">
|
||||||
|
<el-form ref="userForm" :model="userForm" :rules="userFormRules" status-icon label-width="100px">
|
||||||
|
<el-form-item label="用户名" >
|
||||||
|
<el-input v-model="userForm.USERNAME" disabled placeholder="默认用户手机号码..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新密码:" prop="newpwd">
|
||||||
|
<el-input v-model="userForm.newpwd" type="password" auto-complete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="确认密码:" prop="newpassword1">
|
||||||
|
<el-input v-model="userForm.newpassword1" type="password" auto-complete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: center;margin-top:30px">
|
||||||
|
<el-button type="primary" @click.native.prevent="editUser">确认修改</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// import RaddarChart from './components/RaddarChart'
|
// import RaddarChart from './components/RaddarChart'
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { requestFN } from '@/utils/request'
|
import { requestFN } from '@/utils/request'
|
||||||
|
import { MessageBox } from 'element-ui'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
// RaddarChart
|
// RaddarChart
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
const validatePass = (rule, value, callback) => {
|
||||||
|
if (value.length < 1) {
|
||||||
|
callback(new Error('密码不能为空'))
|
||||||
|
}
|
||||||
|
if (value) {
|
||||||
|
var reg1 = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&*.])[\da-zA-Z~!@#$%^&*.]{8,}$/
|
||||||
|
if (!reg1.test(value)) {
|
||||||
|
callback(new Error('密码必须是8位以上、必须包含大小写字母、数字、特殊符号'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const validatePass2 = (rule, value, callback) => {
|
||||||
|
if (this.userForm.newpwd != '' && value === '') {
|
||||||
|
callback(new Error('请再次输入密码'))
|
||||||
|
} else if (value !== this.userForm.newpwd) {
|
||||||
|
callback(new Error('两次输入密码不一致!'))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
|
dialogFormEdit: false,
|
||||||
|
userForm: {
|
||||||
|
USERNAME: '',
|
||||||
|
newpwd: '',
|
||||||
|
newpassword1: ''
|
||||||
|
},
|
||||||
|
userFormRules: {
|
||||||
|
newpwd: [
|
||||||
|
{ required: true, validator: validatePass, trigger: 'blur' }
|
||||||
|
],
|
||||||
|
newpassword1: [
|
||||||
|
{ required: true, validator: validatePass2, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
dialogWarnEnable: false,
|
dialogWarnEnable: false,
|
||||||
custom: '',
|
custom: '',
|
||||||
riskData: {}
|
riskData: {}
|
||||||
|
@ -33,8 +90,17 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
// this.getRiskData()
|
// this.getRiskData()
|
||||||
this.implementationReminder()
|
this.implementationReminder()
|
||||||
|
if (JSON.parse(sessionStorage.getItem('user')).passwordType === '0') {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
}
|
||||||
|
this.userForm.USERNAME = JSON.parse(sessionStorage.getItem('user')).USERNAME
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleClose(done) {
|
||||||
|
if (!this.dialogFormEdit) {
|
||||||
|
done()
|
||||||
|
}
|
||||||
|
},
|
||||||
// 是否实施逾期提醒
|
// 是否实施逾期提醒
|
||||||
implementationReminder(){
|
implementationReminder(){
|
||||||
requestFN(
|
requestFN(
|
||||||
|
@ -49,6 +115,56 @@ export default {
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
editUser() {
|
||||||
|
this.$refs.userForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
requestFN(
|
||||||
|
'/user/editUserOwn',
|
||||||
|
{ USER_ID: this.USER_ID,
|
||||||
|
USERNAME: this.userForm.USERNAME,
|
||||||
|
PASSWORD: this.userForm.newpwd,
|
||||||
|
NAME: this.userForm.NAME,
|
||||||
|
PHONE: this.userForm.PHONE,
|
||||||
|
EMAIL: this.userForm.EMAIL,
|
||||||
|
DEPARTMENT_ID: this.DEPARTMENT_ID,
|
||||||
|
POST_ID: this.userForm.POST_ID,
|
||||||
|
BZ: this.userForm.BZ,
|
||||||
|
OPERATIONTYPE: '1' }
|
||||||
|
).then((data) => {
|
||||||
|
MessageBox.alert('密码修改成功,请重新登录!', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
callback: action => {
|
||||||
|
sessionStorage.clear()
|
||||||
|
this.goOut()
|
||||||
|
location.reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.dialogFormEdit = false
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 下线
|
||||||
|
goOut: function(msg) {
|
||||||
|
requestFN(
|
||||||
|
'/main/logout',
|
||||||
|
{}
|
||||||
|
).then((data) => {
|
||||||
|
// this.fwebsocket.close()
|
||||||
|
sessionStorage.clear()
|
||||||
|
window.location.href = localStorage.getItem('out_url')
|
||||||
|
// window.location.href = 'http://192.168.0.112:8080/'
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
// this.fwebsocket.close()
|
||||||
|
sessionStorage.clear()
|
||||||
|
window.location.href = localStorage.getItem('out_url')
|
||||||
|
// window.location.href = 'http://192.168.0.112:8080/'
|
||||||
|
})
|
||||||
|
},
|
||||||
closeWarn(){
|
closeWarn(){
|
||||||
this.dialogWarnEnable = false
|
this.dialogWarnEnable = false
|
||||||
this.custom = ''
|
this.custom = ''
|
||||||
|
|
|
@ -779,7 +779,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetPwd(id) {
|
resetPwd(id) {
|
||||||
this.$confirm('确定要重置密码为666666吗?', {
|
this.$confirm('确定要重置密码为Jtys@123456吗?', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
|
|
|
@ -344,7 +344,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetPwd(id, name) {
|
resetPwd(id, name) {
|
||||||
this.$confirm('是否重置密码为666666?', {
|
this.$confirm('是否重置密码为Jtys@123456?', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
|
|
|
@ -360,7 +360,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetPwd(id, username) {
|
resetPwd(id, username) {
|
||||||
this.$confirm('是否重置密码为666666?', {
|
this.$confirm('是否重置密码为Jtys@123456?', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
|
|
|
@ -136,7 +136,7 @@ export default {
|
||||||
LEARNERCATEGORYSTATUS: 'select',
|
LEARNERCATEGORYSTATUS: 'select',
|
||||||
SORT: '',
|
SORT: '',
|
||||||
DEPARTUREDESCR: '',
|
DEPARTUREDESCR: '',
|
||||||
PASSWORD: '666666',
|
PASSWORD: 'Jtys@123456',
|
||||||
USERAVATARPREFIX: '',
|
USERAVATARPREFIX: '',
|
||||||
USERAVATARURL: '',
|
USERAVATARURL: '',
|
||||||
USERAVATARURL_CONVERT: '',
|
USERAVATARURL_CONVERT: '',
|
||||||
|
|
Loading…
Reference in New Issue