Commit 9307f567287b6dcf14440298df5361f2084f8cd9
1 parent
a695eb5d
🐛 fix(system):修复租户 get-by-website 接口不支持端口的问题
放宽 website 参数的正则校验,允许携带 :端口号,适配前端通过 location.host 带端口(如 localhost:81、127.0.0.1:81)访问的场景
Showing
2 changed files
with
2 additions
and
2 deletions
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java
| @@ -67,7 +67,7 @@ public class TenantController { | @@ -67,7 +67,7 @@ public class TenantController { | ||
| 67 | @Operation(summary = "使用域名,获得租户信息", description = "登录界面,根据用户的域名,获得租户信息") | 67 | @Operation(summary = "使用域名,获得租户信息", description = "登录界面,根据用户的域名,获得租户信息") |
| 68 | @Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn") | 68 | @Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn") |
| 69 | public CommonResult<TenantRespVO> getTenantByWebsite( | 69 | public CommonResult<TenantRespVO> getTenantByWebsite( |
| 70 | - @RequestParam("website") @Pattern(regexp = "^[a-zA-Z0-9.-]+$", message = "网站域名格式不正确") String website) { | 70 | + @RequestParam("website") @Pattern(regexp = "^[a-zA-Z0-9.-]+(:\\d{1,5})?$", message = "网站域名格式不正确") String website) { |
| 71 | TenantDO tenant = tenantService.getTenantByWebsite(website); | 71 | TenantDO tenant = tenantService.getTenantByWebsite(website); |
| 72 | if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) { | 72 | if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) { |
| 73 | return success(null); | 73 | return success(null); |
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java
| @@ -36,7 +36,7 @@ public class AppTenantController { | @@ -36,7 +36,7 @@ public class AppTenantController { | ||
| 36 | @Operation(summary = "使用域名,获得租户信息", description = "根据用户的域名,获得租户信息") | 36 | @Operation(summary = "使用域名,获得租户信息", description = "根据用户的域名,获得租户信息") |
| 37 | @Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn") | 37 | @Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn") |
| 38 | public CommonResult<AppTenantRespVO> getTenantByWebsite( | 38 | public CommonResult<AppTenantRespVO> getTenantByWebsite( |
| 39 | - @RequestParam("website") @Pattern(regexp = "^[a-zA-Z0-9.-]+$", message = "网站域名格式不正确") String website) { | 39 | + @RequestParam("website") @Pattern(regexp = "^[a-zA-Z0-9.-]+(:\\d{1,5})?$", message = "网站域名格式不正确") String website) { |
| 40 | TenantDO tenant = tenantService.getTenantByWebsite(website); | 40 | TenantDO tenant = tenantService.getTenantByWebsite(website); |
| 41 | if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) { | 41 | if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) { |
| 42 | return success(null); | 42 | return success(null); |