Commit 82b559a2 authored by 张伯涛's avatar 张伯涛

加密问题区分对象加密和单个字段加密

parent 3838ac17
......@@ -16,7 +16,12 @@ export function encrypt(data) {
encryptor.setPublicKey(publicKey)
return encryptor.encrypt(json)
}
export function encryptTwo(data) {
const json = data
const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey)
return encryptor.encrypt(json)
}
export function decrypt(txt) {
const encryptor = new JSEncrypt()
encryptor.setPrivateKey('')
......
......@@ -251,7 +251,7 @@ export default {
this.$router.push('/controlPlatform/control')
}).catch(() => {
this.loading = false
this.verify = false
this.verify = true
if (this.captchaType === 'MATH' || this.captchaType === 'CHAR') {
this.getCode()
}
......
......@@ -46,7 +46,7 @@
</template>
<script>
import { updateUserPwd } from '@/api/system/user.js'
import { encrypt } from '@/utils/jsencrypt'
import { encryptTwo } from '@/utils/jsencrypt'
export default {
name: 'ReSetPsw',
components: {},
......@@ -106,8 +106,8 @@ export default {
this.$refs['pwdForm'].validate((vaild) => {
if (vaild) {
const params = {
oldPassword: encrypt(this.pwdList.oldPass),
newPassword: encrypt(this.pwdList.pass)
oldPassword: encryptTwo(this.pwdList.oldPass),
newPassword: encryptTwo(this.pwdList.pass)
}
updateUserPwd(params).then(res => {
this.$message.success('密码修改成功!')
......
......@@ -395,7 +395,7 @@
</div>
</template>
<script>
import { encrypt } from '@/utils/jsencrypt'
import { encryptTwo } from '@/utils/jsencrypt'
import {
listUser,
getUser,
......@@ -849,7 +849,7 @@ export default {
this.$refs.ruleForm.validate(pass => {
if (pass) {
this.userRestLoading = true
resetUserPwd(this.ruleForm.row, encrypt(this.ruleForm.newPassword)).then(response => {
resetUserPwd(this.ruleForm.row, encryptTwo(this.ruleForm.newPassword)).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
......@@ -894,7 +894,7 @@ export default {
flag: 1,
name: this.form.name,
phone: this.form.phone,
password: encrypt(this.form.password),
password: encryptTwo(this.form.password),
roleList: this.form.roleList,
remarks: this.form.remarks
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment