From 2fd817916072018b631c4f608c75ff455efb42a6 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 13 二月 2025 16:36:11 +0800
Subject: [PATCH] #

---
 rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
index 76c5b80..5b20e70 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
@@ -10,10 +10,11 @@
 import com.vincent.rsf.server.common.config.ConfigProperties;
 import com.vincent.rsf.server.common.security.JwtSubject;
 import com.vincent.rsf.server.common.service.EmailService;
-import com.vincent.rsf.server.common.utils.JwtUtil;
 import com.vincent.rsf.server.common.service.RedisService;
+import com.vincent.rsf.server.common.utils.JwtUtil;
 import com.vincent.rsf.server.system.controller.param.LoginParam;
 import com.vincent.rsf.server.system.controller.param.RegisterParam;
+import com.vincent.rsf.server.system.controller.param.TenantInitParam;
 import com.vincent.rsf.server.system.controller.param.UpdatePasswordParam;
 import com.vincent.rsf.server.system.controller.result.LoginResult;
 import com.vincent.rsf.server.system.controller.result.MenuVo;
@@ -33,7 +34,6 @@
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -107,6 +107,7 @@
         if (Cools.isEmpty(param.getUsername(), param.getPassword(), param.getEmail(), param.getCode())) {
             return R.parse(BaseRes.PARAM);
         }
+        // verify code
         String cacheCode = redisService.getValue(EmailType.REGISTER_VERIFY.toString(), param.getEmail());
         if (Cools.isEmpty(cacheCode)) {
             return R.error("The verification code has expired.");
@@ -115,19 +116,18 @@
             return R.error("The verification code is incorrect.");
         }
 
-
-        User user = new User();
-        user.setUsername(param.getUsername());
-        user.setNickname(param.getUsername());
-        user.setPassword(userService.encodePassword(param.getPassword()));
-        user.setEmail(param.getEmail());
-        user.setEmailVerified(1);
-        user.setStatus(StatusType.ENABLE.val);
-        user.setCreateTime(new Date());
-        if (!userService.save(user)) {
-            throw new CoolException("");
+        // register
+        TenantInitParam initParam = new TenantInitParam();
+        initParam.setEmail(param.getEmail());
+        initParam.setUsername(param.getUsername());
+        initParam.setPassword(param.getPassword());
+        initParam.setName(param.getUsername());
+        initParam.setFlag(param.getUsername());
+        if (!tenantService.initTenant(initParam)) {
+            throw new CoolException("Failed to register");
         }
 
+        redisService.delete(EmailType.REGISTER_VERIFY.toString(), param.getEmail());
         return R.ok();
     }
 

--
Gitblit v1.9.1