wolfboys commented on code in PR #3630:
URL: 
https://github.com/apache/incubator-streampark/pull/3630#discussion_r1539225381


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java:
##########
@@ -116,6 +132,38 @@ public boolean update(Project projectParam) {
     ApiAlertException.throwIfFalse(
         !project.getBuildState().equals(BuildStateEnum.BUILDING.get()),
         "The project is being built, update project failed.");
+    project.setName(projectParam.getName());
+    project.setUrl(projectParam.getUrl());
+    project.setBranches(projectParam.getBranches());
+    project.setPrvkeyPath(projectParam.getPrvkeyPath());
+    project.setUserName(projectParam.getUserName());
+    if (StringUtils.isNotBlank(projectParam.getPassword())) {
+      if (StringUtils.isBlank(project.getPassword())) {
+        String salt = ShaHashUtils.getRandomSalt();
+        try {
+          String encrypt = EncryptUtils.encrypt(projectParam.getPassword(), 
salt);
+          project.setSalt(salt);
+          project.setPassword(encrypt);
+        } catch (Exception e) {
+          log.error("project password encrypt failed");
+          throw new ApiAlertException(e);
+        }
+      } else {
+        // Check whether the encrypted password is the same as the current 
password
+        if (!Objects.equals(project.getPassword(), 
projectParam.getPassword())) {
+          try {
+            String encrypt = EncryptUtils.encrypt(projectParam.getPassword(), 
project.getSalt());
+            project.setPassword(encrypt);
+          } catch (Exception e) {
+            log.error("project password encrypt failed");
+            throw new ApiAlertException(e);
+          }
+        }
+      }
+    }
+    project.setPom(projectParam.getPom());
+    project.setDescription(projectParam.getDescription());
+    project.setBuildArgs(projectParam.getBuildArgs());
     updateInternal(projectParam, project);

Review Comment:
   The code in  135 ~ 139,164 ~ 166 is the same as the logic in the  
updateInternal method, we need delete lines 135 ~ 139,164 ~ 166 



-- 
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: issues-unsubscr...@streampark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to