Browse Source

密码修改加密

wuhb 4 months ago
parent
commit
5d862675d2
1 changed files with 13 additions and 2 deletions
  1. 13 2
      ygtx-ui/src/views/system/user/profile/resetPwd.vue

+ 13 - 2
ygtx-ui/src/views/system/user/profile/resetPwd.vue

@@ -21,6 +21,8 @@
 
 <script setup>
 import { updateUserPwd } from "@/api/system/user"
+import { encryptAES, decryptAES } from '@/utils/cryptoAES'
+import { getIsKey } from '@/utils/crypto'
 
 const { proxy } = getCurrentInstance()
 
@@ -48,9 +50,18 @@ const rules = ref({
 
 /** 提交按钮 */
 function submit() {
-  proxy.$refs.pwdRef.validate(valid => {
+  proxy.$refs.pwdRef.validate(async valid => {
     if (valid) {
-      updateUserPwd(user.oldPassword, user.newPassword).then(response => {
+      let requestForm = {...user}
+      try {
+        const keyObj = await getIsKey()
+        const isKey = keyObj["data"];
+        if("1" === isKey || 1 === isKey){
+          requestForm.oldPassword = encryptAES(user.oldPassword)
+          requestForm.newPassword = encryptAES(user.newPassword)
+        }
+      } catch (error) {}
+      updateUserPwd(requestForm.oldPassword, requestForm.newPassword).then(response => {
         proxy.$modal.msgSuccess("修改成功")
       })
     }