Radeity commented on code in PR #14577:
URL: 
https://github.com/apache/dolphinscheduler/pull/14577#discussion_r1267101567


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java:
##########
@@ -111,6 +111,10 @@ public Result createUser(@Parameter(hidden = true) 
@RequestAttribute(value = Con
                              @RequestParam(value = "email") String email,
                              @RequestParam(value = "phone", required = false) 
String phone,
                              @RequestParam(value = "state", required = false) 
int state) throws Exception {
+        Result verifyRet = usersService.verifyUserName(userName);
+        if (verifyRet.getCode() != Status.SUCCESS.getCode()) {
+            return verifyRet;
+        }

Review Comment:
   Can we also add this check in update api?



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java:
##########
@@ -1336,7 +1336,7 @@ public Map<String, Object> registerUser(String userName, 
String userPassword, St
             putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "two 
passwords are not same");
             return result;
         }
-        User user = createUser(userName, userPassword, email, 1, "", "", 
Flag.NO.ordinal());
+        User user = createUser(userName, userPassword, email, -1, "", "", 
Flag.NO.ordinal());

Review Comment:
   If we set -1, it will cause some possible NPE, like 
   `String tenantCode = 
tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();`
   If you want to modify it, plz make sure to fix those NPE, either :D



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to