update 生产环境开启谷歌验证
This commit is contained in:
@@ -48,11 +48,10 @@ public class LoginInterceptor implements HandlerInterceptor {
|
||||
if (loginRequired == null) {
|
||||
loginRequired = handlerMethod.getBeanType().getAnnotation(LoginRequired.class);
|
||||
}
|
||||
|
||||
String token = request.getHeader(AUTHENTICATION);
|
||||
// 如果没有注解或者注解值为true,则校验token
|
||||
if (loginRequired == null || loginRequired.value()) {
|
||||
String token = request.getHeader(AUTHENTICATION);
|
||||
if (token == null || !isValidToken(token)) {
|
||||
if (loginRequired == null || loginRequired.value() || token != null) {
|
||||
if (!isValidToken(token)) {
|
||||
throw new AuthException("用户未登录");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ import com.m2pool.lease.netty.handler.ChannelManager;
|
||||
import com.m2pool.lease.netty.message.ClientMessage;
|
||||
import com.m2pool.lease.redis.service.RedisService;
|
||||
import com.m2pool.lease.service.*;
|
||||
import com.m2pool.lease.utils.DateUtils;
|
||||
import com.m2pool.lease.utils.SecurityUtils;
|
||||
import com.m2pool.lease.utils.UuidGeneratorUtil;
|
||||
import com.m2pool.lease.utils.WalletRuleCheckUtils;
|
||||
import com.m2pool.lease.utils.*;
|
||||
import com.m2pool.lease.vo.*;
|
||||
import com.m2pool.lease.vo.v2.CoinAndAlgorithmVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -106,14 +103,14 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
|
||||
public Result<String> addOrders(OrderAndCodeVo orderAndCodeVo ) {
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
//TODO 开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
List<OrderInfoVo> orderInfoVoList = orderAndCodeVo.getOrderInfoVoList();
|
||||
|
||||
@@ -710,14 +707,13 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
|
||||
}
|
||||
Map<Long, OrderMiningInfoDto> userAndMinerMap = orderMiningInfoDtoList.stream().collect(Collectors.toMap(OrderMiningInfoDto::getMachineId, Function.identity()));
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
//TODO 开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
Map<Long, OrderInfoVo> collect1 = orderInfoVoList.stream()
|
||||
.collect(Collectors.toMap(OrderInfoVo::getMachineId,Function.identity()));
|
||||
List<LeaseMachine> machineList = leaseMachineMapper.selectBatchIds(collect1.keySet());
|
||||
|
||||
@@ -461,7 +461,7 @@ public class LeaseProductServiceImpl extends ServiceImpl<LeaseProductMapper, Lea
|
||||
public Long getShopIdByUsername(){
|
||||
LeaseShop leaseShop = leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>()
|
||||
.select(LeaseShop::getId)
|
||||
.eq(LeaseShop::getUserEmail, SecurityUtils.getUsername())
|
||||
.eq(LeaseShop::getUserEmail,SecurityUtils.getUsername())
|
||||
.eq(LeaseShop::getDel, false));
|
||||
return leaseShop.getId();
|
||||
}
|
||||
@@ -474,7 +474,8 @@ public class LeaseProductServiceImpl extends ServiceImpl<LeaseProductMapper, Lea
|
||||
String chain = productMachineForWalletConfigVo.getChain();
|
||||
String address = productMachineForWalletConfigVo.getPayAddress();
|
||||
LeaseShop leaseShop = leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>()
|
||||
.eq(LeaseShop::getAuthId, SecurityUtils.getUserId()));
|
||||
.eq(LeaseShop::getAuthId, SecurityUtils.getUserId())
|
||||
.eq(LeaseShop::getDel, false));
|
||||
boolean check = checkHashWalletInfo(leaseShop.getId(),chain,address, payCoinsList);
|
||||
if (!check){
|
||||
return Result.fail("绑定钱包失败,钱包格式不正确或该链和币种钱包已绑定过");
|
||||
|
||||
@@ -631,14 +631,13 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
return Result.fail("提现地址不属于您,请登录正确的账号");
|
||||
}
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(username);
|
||||
//开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), balanceVo.getCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), balanceVo.getCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
//同一个from只能存在一笔提现中的订单
|
||||
Integer recentlyOneData = leasePayWithdrawMessageMapper.getRecentlyOneData(balanceVo.getFromAddress(), balanceVo.getToChain());
|
||||
@@ -711,14 +710,14 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
|
||||
|
||||
//谷歌验证
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(username);
|
||||
//开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), balanceVo.getCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), shopWalletInfoVo.getGCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
LeaseShopConfig leaseShopConfig = leaseShopConfigMapper.selectOne(new LambdaQueryWrapper<LeaseShopConfig>()
|
||||
.eq(LeaseShopConfig::getPayAddress, shopWalletInfoVo.getPayAddress())
|
||||
|
||||
@@ -342,14 +342,13 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
verifyParams(email,password);
|
||||
//2.验证码校验 和谷歌验证码校验
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(SecurityUtils.getUsername());
|
||||
//开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), restPwdVo.getGCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), restPwdVo.getGCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
verifyCode(updatePasswordCodeKey,restPwdVo.getCode());
|
||||
//3.修改密码
|
||||
LeaseUser user = getUser(email);
|
||||
@@ -385,15 +384,14 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
String userEmail = SecurityUtils.getUsername();
|
||||
//1.
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
|
||||
// 开发环境
|
||||
//1.1谷歌验证
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), closeAccountVo.getGCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), closeAccountVo.getGCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
//1.2邮箱验证码验证
|
||||
verifyCode(RedisAuthKey.getCloseAccountKey(userEmail),closeAccountVo.getECode());
|
||||
LeaseShop leaseShop = leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>().eq(LeaseShop::getUserEmail, userEmail)
|
||||
@@ -752,15 +750,14 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
// 根据邮箱查询是否已绑定
|
||||
UserGoogleAuthInfo info = leaseUserMapper.getUserInfoByEmail(email);
|
||||
|
||||
if(StringUtils.isBlank(info.getSecret())){
|
||||
if(info == null || StringUtils.isBlank(info.getSecret())){
|
||||
//未绑定 正常走绑定流程
|
||||
//校验gcode
|
||||
boolean gResult = GoogleAuthenticator.checkCode(googleBindVo.getSecret(),
|
||||
googleBindVo.getGCode(), System.currentTimeMillis());
|
||||
//开发环境
|
||||
//if(!gResult){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(!gResult){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
//校验邮箱验证码
|
||||
String redisKey = RedisAuthKey.getGoogleBindCodeKey(email);
|
||||
if(redisService.hasKey(redisKey)){
|
||||
@@ -812,7 +809,7 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
GoogleInfo info = leaseUserMapper.getGoogleInfoByEmail(email);
|
||||
|
||||
GoogleInfoDto dto = new GoogleInfoDto();
|
||||
if(StringUtils.isBlank(info.getSecret())){
|
||||
if(info == null || StringUtils.isBlank(info.getSecret())){
|
||||
//生成谷歌验证码
|
||||
String secret = GoogleAuthenticator.getSecretKey();
|
||||
String qrCodeText = GoogleAuthenticator.getQrCodeText(secret, email, domain);
|
||||
@@ -998,17 +995,16 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
// 根据邮箱查询是否已绑定
|
||||
UserGoogleAuthInfo info = leaseUserMapper.getUserInfoByEmail(email);
|
||||
|
||||
if(StringUtils.isBlank(info.getSecret())){
|
||||
if(info == null || StringUtils.isBlank(info.getSecret())){
|
||||
return Result.success();
|
||||
}else {
|
||||
|
||||
//已绑定 正常走关闭谷歌验证流程
|
||||
//校验gcode
|
||||
boolean gResult = GoogleAuthenticator.checkCode(info.getSecret(), vo.getGCode(), System.currentTimeMillis());
|
||||
//开发环境
|
||||
//if(!gResult){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(!gResult){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
//校验邮箱验证码
|
||||
String redisKey = RedisAuthKey.getGoogleCloseCodeKey( email);
|
||||
if(redisService.hasKey(redisKey)){
|
||||
@@ -1059,10 +1055,9 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
//已绑定 正常走关闭谷歌验证流程
|
||||
//校验gcode
|
||||
boolean gResult = GoogleAuthenticator.checkCode(info.getSecret(), vo.getGCode(), System.currentTimeMillis());
|
||||
//开发环境
|
||||
//if(!gResult){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(!gResult){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
//校验邮箱验证码
|
||||
String redisKey = RedisAuthKey.getGoogleBindCodeKey( email);
|
||||
if(redisService.hasKey(redisKey)){
|
||||
@@ -1278,14 +1273,13 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
|
||||
}
|
||||
|
||||
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(username);
|
||||
//开发环境
|
||||
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
// //未绑定定谷歌验证器
|
||||
// return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
//}
|
||||
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), balanceVo.getCode(), System.currentTimeMillis())){
|
||||
// return Result.fail("谷歌验证码错误");
|
||||
//}
|
||||
if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
|
||||
//未绑定定谷歌验证器
|
||||
return Result.fail("您的账号未开启双重验证,请先开启验证!");
|
||||
}
|
||||
if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), balanceVo.getCode(), System.currentTimeMillis())){
|
||||
return Result.fail("谷歌验证码错误");
|
||||
}
|
||||
|
||||
//同一个from只能存在一笔提现中的订单
|
||||
Integer recentlyOneData = leasePayWithdrawMessageMapper.getRecentlyOneData(balanceVo.getFromAddress(), balanceVo.getToChain());
|
||||
|
||||
@@ -98,7 +98,7 @@ image:
|
||||
prefix: https://test.m2pool.com
|
||||
|
||||
myenv:
|
||||
domain: https://www.m2pool.com
|
||||
path: /var/www/html/web
|
||||
domain: http://18.183.240.108/
|
||||
path: /var/www/html/web_test
|
||||
img: /img
|
||||
filepath: /home/ubuntu/prod
|
||||
filepath: /home/ubuntu/web
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
from
|
||||
lease_user
|
||||
where
|
||||
user_id = #{email}
|
||||
user_id = #{email} AND del = false AND google_status = 0
|
||||
limit 1
|
||||
</select>
|
||||
<select id="checkSecretIfExist" resultType="java.lang.Boolean">
|
||||
@@ -40,7 +40,7 @@
|
||||
from
|
||||
lease_user
|
||||
where
|
||||
user_id = #{email}
|
||||
user_id = #{email} AND del = false
|
||||
limit 1
|
||||
</select>
|
||||
<select id="checkIfBindByEmail" resultType="java.lang.Integer">
|
||||
|
||||
Reference in New Issue
Block a user