| | |
| | | public void checkSuperGoogleAuthCode(String code) { |
| | | String secret = sysparaService.find("super_google_auth_secret").getSvalue(); |
| | | if (StringUtils.isEmpty(code)) { |
| | | throw new YamiShopBindException("验证码不能为空"); |
| | | throw new YamiShopBindException("Verification code cannot be empty"); |
| | | } |
| | | long t = System.currentTimeMillis(); |
| | | GoogleAuthenticator ga = new GoogleAuthenticator(); |
| | | ga.setWindowSize(5); // should give 5 * 30 seconds of grace... |
| | | boolean checkCode = ga.check_code(secret, Long.valueOf(code), t); |
| | | if (!checkCode && Long.valueOf(code) != 998899) { |
| | | throw new YamiShopBindException("超级管理员谷歌验证码错误"); |
| | | throw new YamiShopBindException("Incorrect super admin Google Authenticator code"); |
| | | } |
| | | } |
| | | |
| | |
| | | SysUser sysUser= getById(SecurityUtils.getSysUser().getUserId()); |
| | | safeword=passwordManager.decryptPassword(safeword); |
| | | if (StrUtil.isEmpty(sysUser.getSafePassword())){ |
| | | throw new YamiShopBindException("资金密码未设置!"); |
| | | throw new YamiShopBindException("Fund password is not set!"); |
| | | } |
| | | if (StrUtil.isEmpty(safeword)){ |
| | | throw new YamiShopBindException("资金密码不正确!"); |
| | | throw new YamiShopBindException("Incorrect fund password!"); |
| | | } |
| | | System.out.printf(safeword+"=="+passwordEncoder+"======"+sysUser.getSafePassword()); |
| | | if (!passwordEncoder.matches(safeword, sysUser.getSafePassword())) { |
| | | throw new YamiShopBindException("资金密码不正确!"); |
| | | throw new YamiShopBindException("Incorrect fund password!"); |
| | | } |
| | | return true; |
| | | } |