|
@@ -15,15 +15,13 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
import javax.imageio.ImageIO;
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.servlet.http.HttpSession;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@RestController
|
|
@@ -42,7 +40,7 @@ public class SmsCodeController extends BaseController {
|
|
|
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String")
|
|
|
@PostMapping("/sendSms")
|
|
|
@PreAuthorize("@pcs.hasPermissions('sys_user_manage')")
|
|
|
- public Object sendLoginVerifyCode(String mobile) {
|
|
|
+ public Object sendLoginVerifyCode(@RequestBody String mobile) {
|
|
|
smsCodeService.sendValidCode(mobile);
|
|
|
return succeed();
|
|
|
}
|
|
@@ -51,7 +49,9 @@ public class SmsCodeController extends BaseController {
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "code", value = "短信验证码", required = true, dataType = "String") })
|
|
|
@PostMapping("/verifySmsCode")
|
|
|
- public Object verifySmsCode(String phone,String code) {
|
|
|
+ public Object verifySmsCode(@RequestBody HashMap<String,String> param) {
|
|
|
+ String phone = param.get("phone");
|
|
|
+ String code = param.get("code");
|
|
|
if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|
|
|
}
|
|
@@ -65,7 +65,9 @@ public class SmsCodeController extends BaseController {
|
|
|
@ApiOperation("校验登录图形验证码")
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "code", value = "验证码", required = true, dataType = "String") })
|
|
|
- public Object verifyImageCode(String phone,String code){
|
|
|
+ public Object verifyImageCode(@RequestBody HashMap<String,String> param){
|
|
|
+ String phone = param.get("phone");
|
|
|
+ String code = param.get("code");
|
|
|
if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|
|
|
}
|
|
@@ -81,11 +83,10 @@ public class SmsCodeController extends BaseController {
|
|
|
@GetMapping("/getLoginImage")
|
|
|
@ApiOperation("获取登录图片验证码")
|
|
|
@ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")
|
|
|
- public void getKaptchaImage(HttpServletResponse response, HttpSession session,String phone) throws Exception {
|
|
|
+ public void getKaptchaImage(HttpServletResponse response,@RequestParam(value = "phone", required = true) String phone) throws Exception {
|
|
|
if(StringUtils.isEmpty(phone)){
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
response.setDateHeader("Expires", 0);
|
|
|
|
|
|
// Set standard HTTP/1.1 no-cache headers.
|