Commit d156213a authored by 张伯涛's avatar 张伯涛

密码加密

parent 3bc87d82
......@@ -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('')
......
......@@ -46,6 +46,7 @@
</template>
<script>
import { updateUserPwd } from '@/api/system/user.js'
import { encryptTwo } from '@/utils/jsencrypt'
export default {
name: 'ReSetPsw',
components: {},
......@@ -82,8 +83,8 @@ export default {
this.$refs['pwdForm'].validate((vaild) => {
if (vaild) {
const params = {
oldPassword: this.pwdList.oldPass,
newPassword: this.pwdList.pass
oldPassword: encryptTwo(this.pwdList.oldPass),
newPassword: encryptTwo(this.pwdList.pass)
}
updateUserPwd(params).then(res => {
this.$message.success('密码修改成功!')
......
......@@ -406,6 +406,7 @@
</div>
</template>
<script>
import { encryptTwo } from '@/utils/jsencrypt'
import {
listUser,
getUser,
......@@ -906,7 +907,7 @@ export default {
this.$refs.ruleForm.validate(pass => {
if (pass) {
this.userRestLoading = true
resetUserPwd(this.ruleForm.row, this.ruleForm.newPassword).then(response => {
resetUserPwd(this.ruleForm.row, encryptTwo(this.ruleForm.newPassword)).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
......@@ -935,7 +936,18 @@ export default {
this.getList()
})
} else {
addUser(this.form).then(response => {
const paramsAdd = {
identity: this.form.identity,
username: this.form.username,
flag: 1,
name: this.form.name,
phone: this.form.phone,
deptId: this.form.deptId,
password: encryptTwo(this.form.password),
roleList: this.form.roleList,
remarks: this.form.remarks
}
addUser(paramsAdd).then(response => {
this.newId = response.data.businessId
this.$message({
message: '新增成功', type: 'success'
......
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