|
|
@ -7,6 +7,7 @@ import com.community.pocket.entity.vo.android.*; |
|
|
|
import com.community.pocket.entity.vo.web.EditScore; |
|
|
|
import com.community.pocket.entity.vo.web.EditScore; |
|
|
|
import com.community.pocket.repository.BaseDao; |
|
|
|
import com.community.pocket.repository.BaseDao; |
|
|
|
import com.community.pocket.repository.CreditScoreDao; |
|
|
|
import com.community.pocket.repository.CreditScoreDao; |
|
|
|
|
|
|
|
import com.community.pocket.repository.EmailDao; |
|
|
|
import com.community.pocket.util.LookupOperationUtil; |
|
|
|
import com.community.pocket.util.LookupOperationUtil; |
|
|
|
import com.mongodb.client.result.UpdateResult; |
|
|
|
import com.mongodb.client.result.UpdateResult; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
@ -35,6 +36,9 @@ public class UserDao extends BaseDao<MyInfo> { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private CreditScoreDao creditScoreDao; |
|
|
|
private CreditScoreDao creditScoreDao; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private EmailDao emailDao; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${register.credit-score}") |
|
|
|
@Value("${register.credit-score}") |
|
|
|
private int creditScore; |
|
|
|
private int creditScore; |
|
|
|
|
|
|
|
|
|
|
@ -131,11 +135,22 @@ public class UserDao extends BaseDao<MyInfo> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//检查新密码是否和原密码重复
|
|
|
|
|
|
|
|
public boolean isNotDiffPwd(UserResetPwd userResetPwd) { |
|
|
|
|
|
|
|
String md5Password = DigestUtils.md5DigestAsHex(userResetPwd.getPassword().getBytes()); |
|
|
|
|
|
|
|
MyInfo myInfo = mongoTemplate.findById(userResetPwd.getUsername(), entityClass()); |
|
|
|
|
|
|
|
return myInfo != null && myInfo.getPassword().equals(md5Password) && emailDao.clearEmail(myInfo.getEmail()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//重置密码
|
|
|
|
//重置密码
|
|
|
|
public boolean resetPwd(String username,String password){ |
|
|
|
public boolean resetPwd(UserResetPwd userResetPwd) { |
|
|
|
if(!StringUtils.isEmpty(username)&&!StringUtils.isEmpty(password)){ |
|
|
|
String username = userResetPwd.getUsername(); |
|
|
|
|
|
|
|
String password = userResetPwd.getPassword(); |
|
|
|
String md5Password = DigestUtils.md5DigestAsHex(password.getBytes()); |
|
|
|
String md5Password = DigestUtils.md5DigestAsHex(password.getBytes()); |
|
|
|
UpdateResult result=mongoTemplate.updateFirst(new Query().addCriteria(Criteria.where("username").is(username)), Update.update("password",md5Password),entityClass()); |
|
|
|
if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(md5Password)) { |
|
|
|
|
|
|
|
UpdateResult result = mongoTemplate.updateFirst(new Query().addCriteria( |
|
|
|
|
|
|
|
Criteria.where("username").is(username)), |
|
|
|
|
|
|
|
Update.update("password", md5Password), entityClass()); |
|
|
|
return result.wasAcknowledged(); |
|
|
|
return result.wasAcknowledged(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|