vishesh92 commented on code in PR #12078:
URL: https://github.com/apache/cloudstack/pull/12078#discussion_r2681566416


##########
server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManagerImpl.java:
##########
@@ -179,10 +181,21 @@ public void setResetTokenAndSend(UserAccount userAccount) 
{
         final String email = userAccount.getEmail();
         final String username = userAccount.getUsername();
         final String subject = "Password Reset Request";
-        final String domainUrl = UserPasswordResetDomainURL.value();
+        String domainUrl = UserPasswordResetDomainURL.value();
+        if (StringUtils.isBlank(domainUrl)) {
+            domainUrl = ManagementServerAddresses.value().split(",")[0];
+        }
+        domainUrl = domainUrl.replaceAll("/+$", "");
 
-        String resetLink = 
String.format("/client/#/user/resetPassword?username=%s&token=%s",
-                username, resetToken);
+        if (!domainUrl.startsWith("http://";) && 
!domainUrl.startsWith("https://";)) {
+            if (ServerProperties.isHttpsEnabled()) {
+                domainUrl = "https://"; + domainUrl;
+            } else {
+                domainUrl = "http://"; + domainUrl;
+            }
+        }
+        String resetLink = 
String.format("%s/client/#/user/resetPassword?username=%s&token=%s",

Review Comment:
   This is changing the definition of `resetLink`. This could cause issues 
during an upgrade. Let's just append `/` at the end of the domain URL and use 
`{{{domainUrl}}}/{{{resetLink}}}`.



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