|
@@ -15,10 +15,7 @@ import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -26,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -271,17 +269,20 @@ public class LoginController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param request
|
|
|
+ * @param mobile 手机号
|
|
|
* @param inputSmsCode 输入的短信验证码
|
|
|
* @return
|
|
|
* @description 校验短信验证码
|
|
|
* @date 2019/11/27 10:03 AM
|
|
|
*/
|
|
|
- @RequestMapping("/checkSmsCode")
|
|
|
+ @GetMapping("/checkSmsCode")
|
|
|
@ResponseBody
|
|
|
- public RestResponse checkSmsCode(HttpServletRequest request, String inputSmsCode) {
|
|
|
- //从session中获取手机号
|
|
|
- String mobile = (String) request.getSession().getAttribute(AliConstants.SmsConstants.MOBILE);
|
|
|
+ public RestResponse checkSmsCode(@RequestParam String mobile, @RequestParam String inputSmsCode) {
|
|
|
+
|
|
|
+ if (Objects.isNull(mobile) || Objects.isNull(inputSmsCode)) {
|
|
|
+ return RestResponse.fail(ApiConstants.RESULT_ERROR, "手机号或验证码输入有误!");
|
|
|
+ }
|
|
|
+
|
|
|
//从redis中获取短信验证码
|
|
|
Object smsCode = redisTemplate.opsForValue().get(mobile + AliConstants.SmsConstants.SMS_CODE_FIELD);
|
|
|
if (smsCode != null) {
|