|
|
|
|
@ -2,7 +2,6 @@ package cn.jyjz.xiaoyao.framework.security.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.config.XiaoyaoConfig;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.constant.RequestParameterConstans;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenOnlineService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.validator.PhoneNumberValidator;
|
|
|
|
|
@ -14,10 +13,10 @@ import cn.jyjz.xiaoyao.common.redis.cache.constants.CacheConstants;
|
|
|
|
|
import cn.jyjz.xiaoyao.framework.security.authentication.sms.SmsProvider;
|
|
|
|
|
import cn.jyjz.xiaoyao.framework.security.model.AdminUserModel;
|
|
|
|
|
import cn.jyjz.xiaoyao.framework.security.service.SmsLoginService;
|
|
|
|
|
import cn.jyjz.xiaoyao.framework.security.sms.MsmService;
|
|
|
|
|
import cn.jyjz.xiaoyao.framework.security.utils.JwtUtils;
|
|
|
|
|
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.security.authentication.UsernamePasswordAuthenticationToken;
|
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
|
@ -26,6 +25,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
|
|
|
|
|
@ -46,6 +47,9 @@ public class SmsLoginServiceImpl implements SmsLoginService {
|
|
|
|
|
private SmsProvider smsProvider;
|
|
|
|
|
@Resource
|
|
|
|
|
private XiaoyaoConfig xiaoyaoConfig;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private MsmService msmservice;
|
|
|
|
|
@Override
|
|
|
|
|
public ResultVo sendCode(String phone) {
|
|
|
|
|
//校验手机号
|
|
|
|
|
@ -55,8 +59,12 @@ public class SmsLoginServiceImpl implements SmsLoginService {
|
|
|
|
|
}
|
|
|
|
|
//生成验证码
|
|
|
|
|
String code = RandomUtil.randomNumbers(6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 发送短信
|
|
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
|
|
map.put("code",code);
|
|
|
|
|
msmservice.send(map,phone);
|
|
|
|
|
|
|
|
|
|
//用户登录信息写入缓存
|
|
|
|
|
iCacheManager.put(CacheConstants.USER_PHONE_MODEL_NAME,phone,code,CacheConstants.CACHE_TIME);
|
|
|
|
|
|
|
|
|
|
|