From 9af56f878cc3e22d3bce6ab53d67f3753470a7ac Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期五, 14 二月 2025 08:59:22 +0800 Subject: [PATCH] # --- rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java index c1d7292..ea68f4a 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.exception.CoolException; +import com.vincent.rsf.server.common.domain.BusinessRes; +import com.vincent.rsf.server.common.exception.BusinessException; +import com.vincent.rsf.server.common.service.EmailService; import com.vincent.rsf.server.system.controller.param.TenantInitParam; import com.vincent.rsf.server.system.entity.*; import com.vincent.rsf.server.system.enums.StatusType; @@ -32,6 +35,8 @@ private UserRoleService userRoleService; @Autowired private RoleMenuService roleMenuService; + @Autowired + private EmailService emailService; @Override @Transactional @@ -45,9 +50,12 @@ } if (null != userService.getByUsername(param.getUsername(), null)) { - throw new CoolException("the username already exist"); + throw new BusinessException(BusinessRes.USERNAME_EXIST); } if (!Cools.isEmpty(param.getEmail())) { + if (!emailService.isValid(param.getEmail())) { + throw new CoolException("Please enter a valid email address"); + } if (null != userService.getByEmail(param.getEmail(), null)) { throw new CoolException("the email already exist"); } -- Gitblit v1.9.1