yangyichao-mango commented on a change in pull request #3403:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/3403#discussion_r464958846



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java
##########
@@ -432,14 +433,36 @@ public Result authorizedUser(@ApiIgnore 
@RequestAttribute(value = Constants.SESS
                                @RequestParam(value = "userPassword") String 
userPassword,
                                @RequestParam(value = "repeatPassword") String 
repeatPassword,
                                @RequestParam(value = "email") String email) 
throws Exception {
-        userName = userName.replaceAll("[\n|\r|\t]", "");
-        userPassword = userPassword.replaceAll("[\n|\r|\t]", "");
-        repeatPassword = repeatPassword.replaceAll("[\n|\r|\t]", "");
-        email = email.replaceAll("[\n|\r|\t]", "");
+        String parameterFormat = "[\n|\r|\t]";
+        userName = userName.replaceAll(parameterFormat, "");
+        userPassword = userPassword.replaceAll(parameterFormat, "");
+        repeatPassword = repeatPassword.replaceAll(parameterFormat, "");
+        email = email.replaceAll(parameterFormat, "");
         logger.info("user self-register, userName: {}, userPassword {}, 
repeatPassword {}, eamil {}",
-                userName, userPassword, repeatPassword, email);
+                userName, Constants.PASSWORD_DEFAULT, 
Constants.PASSWORD_DEFAULT, email);
         Map<String, Object> result = usersService.registerUser(userName, 
userPassword, repeatPassword, email);
         return returnDataList(result);
     }
 
+    /**
+     * user activate
+     *
+     * @param userName       user name
+     */
+    @ApiOperation(value="activateUser",notes = "ACTIVATE_USER_NOTES")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userName", value = "USER_NAME", type = 
"String"),
+    })
+    @PostMapping("/activate")
+    @ResponseStatus(HttpStatus.OK)
+    @ApiException(UPDATE_USER_ERROR)
+    public Result<Object> activateUser(@ApiIgnore @RequestAttribute(value = 
Constants.SESSION_USER) User loginUser,
+                                       @RequestParam(value = "userName") 
String userName) {
+        String parameterFormat = "[\n|\r|\t]";

Review comment:
       Add parameterFormat to Constants for better performance.




----------------------------------------------------------------
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.

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


Reply via email to