|
|
@@ -243,6 +243,12 @@ public class UserService {
|
|
|
return setPassword(userId, password);
|
|
|
}
|
|
|
|
|
|
+ public String forgotPassword(String phone, String password, String code) {
|
|
|
+ User user = userRepo.findByPhoneAndDelFalse(phone).orElseThrow(new BusinessException("手机号未注册"));
|
|
|
+ smsService.verify(user.getPhone(), code);
|
|
|
+ return setPassword(user.getId(), password);
|
|
|
+ }
|
|
|
+
|
|
|
public void bindPhone(Long userId, String phone) {
|
|
|
User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
|
|
|
if (StringUtils.isNoneEmpty(user.getPhone())) {
|