| | |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.text.CharSequenceUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.digest.MD5; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.cache.Cache; |
| | | import cn.lili.cache.CachePrefix; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.catalina.security.SecurityUtil; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | |
| | | throw new ServiceException(ResultCode.USER_NOT_EXIST); |
| | | } |
| | | //判断密码是否输入正确 |
| | | |
| | | if (!new BCryptPasswordEncoder().matches(password, member.getPassword())) { |
| | | throw new ServiceException(ResultCode.USER_PASSWORD_ERROR); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Member autoRegister(ConnectAuthUser authUser) { |
| | | public Member autoRegister(ConnectAuthUser authUser,Boolean encryptTwice) { |
| | | |
| | | if (CharSequenceUtil.isEmpty(authUser.getNickname())) { |
| | | authUser.setNickname(CommonUtil.getSpecialStr("用户")); |
| | |
| | | // String username = UuidUtils.getUUID(); |
| | | Member member = new Member(authUser.getUsername(), UuidUtils.getUUID(), authUser.getAvatar(), authUser.getNickname(), |
| | | authUser.getGender() != null ? Convert.toInt(authUser.getGender().getCode()) : 0, authUser.getPhone()); |
| | | member.setPassword(DEFAULT_PASSWORD); |
| | | if(encryptTwice){ |
| | | member.setPassword( new BCryptPasswordEncoder().encode(SecureUtil.md5(DEFAULT_PASSWORD))); |
| | | }else { |
| | | member.setPassword( new BCryptPasswordEncoder().encode(DEFAULT_PASSWORD)); |
| | | } |
| | | member.setUuId(authUser.getUuid()); |
| | | // 发送会员注册信息 |
| | | registerHandler(member); |
| | |
| | | |
| | | @Override |
| | | public Result resetPassword(String id) { |
| | | String password = "123456"; |
| | | String password = "111111"; |
| | | Member member = this.getById(id); |
| | | member.setPassword(new BCryptPasswordEncoder().encode(password)); |
| | | this.updateById(member); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.err.println(SecureUtil.md5("111111")); |
| | | } |
| | | |
| | | } |