Commit 5226d818 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev' into dev

parents 264c65fa 14d5a277
......@@ -5,22 +5,14 @@ import com.github.wxiaoqi.security.auth.service.AuthService;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.ClientUtil;
import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.util.IpUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
......@@ -83,9 +75,9 @@ public class AuthController {
return new ObjectRestResponse<>();
}
@RequestMapping(value = "/sendsms", method = RequestMethod.POST)
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type)throws Exception{
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, String pointList)throws Exception{
log.info(username+"----require sendsms...");
return appAuthService.sendsms(username,type);
return appAuthService.sendsms(username,type,pointList);
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public JSONObject register(@RequestParam(value="username",defaultValue="")String username,
......@@ -180,7 +172,7 @@ public class AuthController {
@RequestMapping(value = "other/sendsms", method = RequestMethod.GET)
public JSONObject otherSendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type)throws Exception{
log.info(username+"----require sendsms...");
return appAuthService.sendsms(username,type);
return appAuthService.sendsms(username,type, "");
}
@RequestMapping(value = "/otherLogin", method = RequestMethod.POST)
......
......@@ -29,7 +29,7 @@ public interface IUserService {
AppUserInfo AppValidate(@RequestBody JwtAuthenticationRequest authenticationRequest);
@RequestMapping(value = "/api/app/user/sendsms", method = RequestMethod.POST)
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type);
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="pointList")String pointList);
@RequestMapping(value = "/api/app/user/register", method = RequestMethod.POST)
public JSONObject register( @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
......
......@@ -4,18 +4,15 @@ package com.github.wxiaoqi.security.auth.service;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
public interface AuthService {
String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
String refresh(String oldToken) throws Exception;
void validate(String token) throws Exception;
JSONObject sendsms(String username, Integer type) throws Exception;
JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception;
JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception;
JSONObject sendsms(String username, Integer type, String pointList) throws Exception;
JSONObject register(String username, String mobilecode, String password,String code, Integer channel) throws Exception;
JSONObject wxregister( String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code, Integer channel) throws Exception;
JSONObject checkBindWechat(String username) throws Exception;
JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception;
JSONObject tlogin(String username, String password,String mobilecode,Integer type,String code) throws Exception;
......
......@@ -13,14 +13,11 @@ import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
/**
* @author keliii
*/
......@@ -69,17 +66,17 @@ public class AppAuthServiceImpl implements AuthService {
jwtTokenUtil.getInfoFromToken(token);
}
@Override
public JSONObject sendsms(String username, Integer type) throws Exception {
return userService.sendsms(username,type);
public JSONObject sendsms(String username, Integer type, String pointList) throws Exception {
return userService.sendsms(username,type,pointList);
}
@Override
public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
public JSONObject register(String username, String mobilecode, String password,String code, Integer channel) throws Exception {
return userService.register(username,mobilecode,password,code,channel);
}
@Override
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code,Integer channel) throws Exception {
public JSONObject wxregister(String username, String mobilecode, String password, String nickname, String headimgurl, String openid, String unionid, Integer type,Integer isQQ,String code, Integer channel) throws Exception {
return userService.wxregister(username,mobilecode,password,nickname,headimgurl,openid,unionid,type,isQQ,code,channel);
}
......
......@@ -65,8 +65,8 @@ public class AuthServiceImpl implements AuthService {
return jwtTokenUtil.generateToken(jwtTokenUtil.getInfoFromToken(oldToken));
}
@Override
public JSONObject sendsms(String username, Integer type) throws Exception {
return userService.sendsms(username,type);
public JSONObject sendsms(String username, Integer type, String pointList) throws Exception {
return userService.sendsms(username,type, pointList);
}
@Override
public JSONObject register(String username, String mobilecode, String password,String code,Integer channel) throws Exception {
......
......@@ -71,7 +71,7 @@ public class AppUserRest {
*/
@RequestMapping(value = "/user/sendsms", method = RequestMethod.POST)
public @ResponseBody
JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, String pointList){
JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="pointList")String pointList){
return appPermissionService.sendSMS(username,type, pointList);
}
......
......@@ -57,9 +57,14 @@ public class CaptchaController {
captchaBaseParam.setUrlOrPath(ImageUtils.getClickWordBgPath());
captcha.setFontColorRandom(false);
ClickWordCaptchaVO dataVO = (ClickWordCaptchaVO) captcha.create(captchaBaseParam);
log.info("获取注册验证码:》》》{}", dataVO.getPointList());
if (dataVO.getPointList() != null) {
try {
String redisLockKey = RedisKey.CAPTCHA_PHONE_PREFIX + phone;
String captchaCode = redisTemplate.opsForValue().get(redisLockKey) == null ? "" : redisTemplate.opsForValue().get(redisLockKey).toString();
if (StringUtils.isNotBlank(captchaCode)) {
redisTemplate.delete(redisLockKey);
}
Boolean suc = redisTemplate.opsForValue().setIfAbsent(redisLockKey, JSONArray.toJSONString(dataVO.getPointList()));
if (suc) {
redisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期
......
......@@ -58,11 +58,11 @@ public class ClickWordCaptcha extends AbstractCaptcha {
int x1 = (int)point1.getX();
int y1 = (int)point1.getY();
if (Math.abs(x-x1) >= HAN_ZI_SIZE_HALF || Math.abs(y-y1) >= HAN_ZI_SIZE_HALF){
return false;
if (Math.abs(x-x1) <= HAN_ZI_SIZE_HALF && Math.abs(y-y1) <= HAN_ZI_SIZE_HALF){
return true;
}
}
return true;
return false;
}
private ClickWordCaptchaVO getImageData(BufferedImage backgroundImage) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment