Ver código fonte

fix(登录): 添加密码非空校验防止加密空密码

当密码为空时跳过加密步骤,避免潜在的空指针异常
张旭伟 1 mês atrás
pai
commit
95a90cf238
1 arquivos alterados com 5 adições e 2 exclusões
  1. 5 2
      src/view/login/index.vue

+ 5 - 2
src/view/login/index.vue

@@ -152,8 +152,11 @@ const getCaptchaImage = async () => {
 const onSignIn = async () => {
   state.loading.signIn = true
   const params = JSON.parse(JSON.stringify(state.form))
-  const encryptedPassword = encryptWithBackendConfig(params.password);
-  params.saltValue = encryptedPassword; // 后端AES IV常量
+  if (params.password) {
+    const encryptedPassword = encryptWithBackendConfig(params.password);
+    params.saltValue = encryptedPassword; // 后端AES IV常量
+  }
+  
   params.password = sm3(params.password)
   params.openId = openId.value
   params.unionId = unionId.value