1
zj
2025-05-20 f1f519b5d186f786f25a987fc870fe9f568ecfcc
src/main/java/project/web/api/UserController.java
@@ -707,51 +707,51 @@
         if (StringUtils.isEmptyString(verifcode_type)) {
            throw new BusinessException("验证类型不能为空");
         }
         if (StringUtils.isEmptyString(verifcode)) {
            throw new BusinessException("验证码不能为空");
         }
//         if (StringUtils.isEmptyString(verifcode)) {
//            throw new BusinessException("验证码不能为空");
//         }
         String loginPartyId = this.getLoginPartyId();
         Party party = this.partyService.cachePartyBy(loginPartyId, false);
         SecUser secUser = this.secUserService.findUserByPartyId(loginPartyId);
         // 根据验证类型获取验证key verifcode_type: 1/手机;2/邮箱;3/谷歌验证器;
         String key = "";
         String errMsg = "";
         if ("1".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone();
            errMsg = "未绑定手机号";
         } else if ("2".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail();
            errMsg = "未绑定邮箱";
         } else if ("3".equals(verifcode_type)) {
            key = StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret();
            errMsg = "未绑定谷歌验证器";
         }
         if (StringUtils.isEmptyString(key)) {
            throw new BusinessException(errMsg);
         }
//         String key = "";
//         String errMsg = "";
//         if ("1".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone();
//            errMsg = "未绑定手机号";
//         } else if ("2".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail();
//            errMsg = "未绑定邮箱";
//         } else if ("3".equals(verifcode_type)) {
//            key = StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret();
//            errMsg = "未绑定谷歌验证器";
//         }
//         if (StringUtils.isEmptyString(key)) {
//            throw new BusinessException(errMsg);
//         }
         // 验证
         boolean passed = false;
         if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
            String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
            if ((null != authcode) && (authcode.equals(verifcode))) {
               passed = true;
               this.identifyingCodeTimeWindowService.delAuthCode(key);
            }
         } else if ("3".equals(verifcode_type)) {
            if (this.googleAuthService.checkCode(key, verifcode)) {
               passed = true;
            }
         }
         // 如果是演示用户,则不判断验证码
         if (!"GUEST".contentEquals(party.getRolename())) {
            if (!passed) {
               throw new BusinessException("验证码不正确");
            }
         }
//         boolean passed = false;
//         if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
//            String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
//            if ((null != authcode) && (authcode.equals(verifcode))) {
//               passed = true;
//               this.identifyingCodeTimeWindowService.delAuthCode(key);
//            }
//         } else if ("3".equals(verifcode_type)) {
//            if (this.googleAuthService.checkCode(key, verifcode)) {
//               passed = true;
//            }
//         }
//
//         // 如果是演示用户,则不判断验证码
//         if (!"GUEST".contentEquals(party.getRolename())) {
//            if (!passed) {
//               throw new BusinessException("验证码不正确");
//            }
//         }
         // 更新密码
         this.partyService.updateSafeword(party, safeword);
@@ -998,9 +998,9 @@
            data.put("phone", StringUtils.isEmptyString(party.getPhone()) || false == party.getPhone_authority() ? "" : party.getPhone());
            data.put("phone_filled", StringUtils.isEmptyString(party.getPhone()) ? "" : party.getPhone());
            data.put("phone_authority", party.getPhone_authority());
            data.put("email", StringUtils.isEmptyString(party.getEmail()) || false == party.getEmail_authority() ? "" : party.getEmail());
            data.put("email", party.getEmail());
            data.put("email_filled", StringUtils.isEmptyString(party.getEmail()) ? "" : party.getEmail());
            data.put("email_authority", party.getEmail_authority());
            data.put("email_authority", true);
            data.put("google_auth_secret", StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) || false == secUser.isGoogle_auth_bind() ? "" : secUser.getGoogle_auth_secret());
            data.put("google_auth_secret_filled", StringUtils.isEmptyString(secUser.getGoogle_auth_secret()) ? "" : secUser.getGoogle_auth_secret());
            data.put("google_auth_bind", secUser.isGoogle_auth_bind());