🐛 Fix: [后台]:修改验证码校验逻辑,解决验证为空能通过校验的bug
This commit is contained in:
parent
29ca1f0676
commit
af1d063709
@ -6,7 +6,7 @@ import com.fanxb.bookmark.business.bookmark.entity.MoveNodeBody;
|
||||
import com.fanxb.bookmark.common.constant.EsConstant;
|
||||
import com.fanxb.bookmark.common.entity.Bookmark;
|
||||
import com.fanxb.bookmark.common.entity.EsEntity;
|
||||
import com.fanxb.bookmark.common.exception.CustomException;
|
||||
import com.fanxb.bookmark.common.exception.FormDataException;
|
||||
import com.fanxb.bookmark.common.util.EsUtil;
|
||||
import com.fanxb.bookmark.common.util.UserContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -203,7 +203,7 @@ public class BookmarkService {
|
||||
try {
|
||||
bookmarkDao.insertOne(bookmark);
|
||||
} catch (DuplicateKeyException e) {
|
||||
throw new CustomException("同级目录下不能存在相同名称的数据");
|
||||
throw new FormDataException("同级目录下不能存在相同名称的数据");
|
||||
}
|
||||
//如果是书签,插入到es中
|
||||
if (bookmark.getType() == 0) {
|
||||
|
@ -7,7 +7,6 @@ import com.fanxb.bookmark.business.user.entity.RegisterBody;
|
||||
import com.fanxb.bookmark.common.constant.Constant;
|
||||
import com.fanxb.bookmark.common.entity.MailInfo;
|
||||
import com.fanxb.bookmark.common.entity.User;
|
||||
import com.fanxb.bookmark.common.exception.CustomException;
|
||||
import com.fanxb.bookmark.common.exception.FormDataException;
|
||||
import com.fanxb.bookmark.common.util.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -71,8 +70,8 @@ public class UserService {
|
||||
public void register(RegisterBody body) {
|
||||
String codeKey = Constant.authCodeKey(body.getEmail());
|
||||
String realCode = RedisUtil.get(codeKey, String.class);
|
||||
if ((!StringUtil.isEmpty(realCode)) && (!realCode.equals(body.getAuthCode()))) {
|
||||
throw new CustomException("验证码错误");
|
||||
if (StringUtil.isEmpty(realCode) || (!realCode.equals(body.getAuthCode()))) {
|
||||
throw new FormDataException("验证码错误");
|
||||
}
|
||||
RedisUtil.delete(codeKey);
|
||||
User user = userDao.selectByUsernameOrEmail(body.getUsername(), body.getEmail());
|
||||
@ -148,12 +147,12 @@ public class UserService {
|
||||
/**
|
||||
* Description: 根据userId获取用户信息
|
||||
*
|
||||
* @author fanxb
|
||||
* @date 2019/7/30 15:57
|
||||
* @param userId userId
|
||||
* @return com.fanxb.bookmark.common.entity.User
|
||||
* @author fanxb
|
||||
* @date 2019/7/30 15:57
|
||||
*/
|
||||
public User getUserInfo(int userId){
|
||||
public User getUserInfo(int userId) {
|
||||
return userDao.selectByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ spring:
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 20
|
||||
max-wait: 1000ms
|
||||
max-wait: 500ms
|
||||
max-idle: 20
|
||||
min-idle: 2
|
||||
datasource:
|
||||
|
Loading…
x
Reference in New Issue
Block a user