1. prod
This commit is contained in:
2026-02-05 11:53:26 +08:00
parent 80826ea6dc
commit 463f58b69e
3 changed files with 57 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package org.springblade.modules.auth.endpoint;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
@@ -21,10 +22,13 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.resource.builder.SmsBuilder;
import org.springblade.modules.resource.utils.AliyunDynpsService;
import org.springblade.modules.resource.utils.SmsUtil;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Wrapper;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -60,6 +64,8 @@ public class Oauth2SmsEndpoint {
private final AliyunDynpsService dynpsService;
private final IUserService service;
/**
* 短信验证码发送
*
@@ -100,10 +106,8 @@ public class Oauth2SmsEndpoint {
Boolean registerOpen = Func.toBoolean(ParamCache.getValue(REGISTER_USER_VALUE), false);
// 校验手机是否已注册,防止恶意发送验证码
OAuth2Request request = OAuth2Request.create();
request.setTenantId(tenantId);
OAuth2User oAuth2User = userService.loadByPhone(decryptedPhone, request);
if (oAuth2User != null) {
long count = service.count(Wrappers.<User>lambdaQuery().eq(User::getAccount, decryptedPhone));
if (count > 0) {
return R.fail("该用户已注册");
}
if (simpleSMSOpen && registerOpen) {