nimbustech-lab opened a new issue, #12050:
URL: https://github.com/apache/cloudstack/issues/12050

   ### problem
   
   When configuring password reset email templates in CloudStack 4.22, the 
variable _{{domainUrl}}_ or _{{{domainUrl}}}_ is ignored during email 
generation.
   The reset link in the email only contains a relative path (e.g., 
_/client/#/user/resetPassword?..._) instead of a complete URL 
(_https://cloudstack.example.com/client/#/user/resetPassword?..._).
   
   This causes broken links when users click “Reset Password” from the email, 
as the base domain is missing.
   
   ### versions
   
   General Information:
   - CloudStack version: 4.22.0 (upgraded from 4.21.0)
   - Operating System: Ubuntu Server 24.04 LTS
   - Java version: OpenJDK 17.0.16
   
   Deployment Setup:
   - Number of Management Server(s): 2 (1 Active + 1 Stopped)
   - CloudStack DB Server(s): 2 MySQL DB (1 Primary + 1 Replica)
   - Hypervisor: VMware ESXi (version 7.0 Update 3)
   - vCenter Version: vSphere Client version 7.0.3.00000
   - ESXi Hosts: 2
   - SMTP Server: Microsoft Office 365 (smtp.office365.com, port 587)
   
   ### The steps to reproduce the bug
   
   1. Find the global configuration called "User password reset mail domain 
url" and put in the relevant domain name.
   2. Find another global configuration called "User password reset mail 
template" and you can choose to either edit or use the default email template 
to test SMTP.
   3. Once configured both, you need to wait for 30 seconds then try to request 
a password reset on the landing / login page.
   4. Once the email comes in, it will show the message you've written with the 
broken password reset link. It will not have the {{{domainUrl}}} called into 
the email / message template. Only resetLink, token will be called succesfully 
into the email / message.
   ...
   
   
   ### What to do about it?
   
   The variable _{{{domainUrl}}}_ defined in **Global Settings → 
user.password.reset.mail.domain.url** should be properly parsed and included in 
the email body when rendering the reset link.
   
   Currently, the email template engine ignores the {{{domainUrl}}} placeholder 
entirely, resulting in an incomplete reset link that starts only from 
_client/#/user/resetPassword?...._
   
   To fix this:
   
   1. Ensure that the _domainUrl_ variable is fetched and passed correctly to 
the email rendering context (e.g., in _UserPasswordResetManagerImpl.java_).
   2. Verify that both _domainUrl_ and _resetLink_ variables are available to 
the Mustache template at render time.
   3. Consider adding a validation check to confirm that _domainUrl_ is not 
null or empty before sending the email.
   4. (Optional) Update the documentation to clarify how 
_user.password.reset.mail.domain.url_ interacts with the reset link template 
variables.
   
   This would ensure the password reset email renders correctly as:
   
`https://cloudstack.example.com/client/#/user/resetPassword?username=user&token=xxxx`


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