Michael Wang 4 жил өмнө
parent
commit
46e22cea1e

+ 3 - 3
src/api/examwork-student.js

@@ -1,6 +1,6 @@
 import { httpApp } from "@/plugins/axiosIndex";
 import { pickBy } from "lodash-es";
-import { object2QueryString, AESString } from "@/utils/utils";
+import { object2QueryString, encodePassword } from "@/utils/utils";
 
 export function searchStudents({
   enable,
@@ -32,7 +32,7 @@ export function saveStudent({
   );
   return httpApp.post("/api/admin/student/save", {
     ...data,
-    ...(password.length > 0 ? { password: AESString(password) } : {}),
+    ...(password.length > 0 ? { password: encodePassword(password) } : {}),
   });
 }
 
@@ -43,7 +43,7 @@ export function toggleEnableStudent({ id, enable }) {
 export function resetStudentPassword({ id, password }) {
   return httpApp.post("/api/admin/student/updatePwd", {
     id,
-    password: AESString(password),
+    password: encodePassword(password),
   });
 }
 

+ 2 - 2
src/api/login.js

@@ -1,10 +1,10 @@
 import { httpApp } from "@/plugins/axiosIndex";
-import { object2QueryString, AESString } from "@/utils/utils";
+import { object2QueryString, encodePassword } from "@/utils/utils";
 
 export function loginByUsername({ loginName, password, code }) {
   const data = {
     loginName,
-    password: AESString(password),
+    password: encodePassword(password),
     code,
   };
   return httpApp.post("/api/admin/user/login/account", data, {

+ 3 - 3
src/api/system-user.js

@@ -1,6 +1,6 @@
 import { httpApp } from "@/plugins/axiosIndex";
 import { pickBy } from "lodash-es";
-import { object2QueryString, AESString } from "@/utils/utils";
+import { object2QueryString, encodePassword } from "@/utils/utils";
 
 export function searchUsers({
   orgId = "",
@@ -34,7 +34,7 @@ export function saveUser({
   );
   return httpApp.post("/api/admin/user/save", {
     ...data,
-    ...(password.length > 0 ? { password: AESString(password) } : {}),
+    ...(password.length > 0 ? { password: encodePassword(password) } : {}),
   });
 }
 
@@ -45,7 +45,7 @@ export function toggleEnableUser({ id, enable }) {
 export function resetUserPassword({ id, password }) {
   return httpApp.post("/api/admin/user/updatePwd", {
     id,
-    password: AESString(password),
+    password: encodePassword(password),
   });
 }
 

+ 4 - 0
src/utils/utils.js

@@ -38,6 +38,10 @@ export function AESString(content) {
   return encrypted.toString();
 }
 
+export function encodePassword(content) {
+  return window.btoa(content);
+}
+
 export function object2QueryString(obj) {
   return queryString.stringify(obj);
 }