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


##########
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:
   `resetLink` was used earlier, and there is regression with 
https://github.com/apache/cloudstack/pull/11379. `domainUrl` is never passed to 
build the message content, keeping `resetLink` as earlier which url as well.



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