fix(tenant): 更新域名正则表达式验证规则

- 修复了网站域名格式验证的正则表达式
- 新增对域名开头结尾连字符的校验
- 增加对端口号格式的支持
- 完善域名段长度限制验证
pull/247/head
chenwenke 2026-04-21 10:38:31 +08:00
parent f5f53d59ca
commit a62ace41a2
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ public class TenantController {
@Operation(summary = "使用域名,获得租户信息", description = "登录界面,根据用户的域名,获得租户信息")
@Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn")
public CommonResult<TenantRespVO> getTenantByWebsite(
@RequestParam("website") @Pattern(regexp = "^[a-zA-Z0-9.-]+$", message = "网站域名格式不正确") String website) {
@RequestParam("website") @Pattern(regexp = "^(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*(:[0-9]{1,5})?$", message = "网站域名格式不正确") String website) {
TenantDO tenant = tenantService.getTenantByWebsite(website);
if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) {
return success(null);