fix: allow newlines in SMS/MFA OTP templates #2132
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix - Allows newlines (\n) in SMS and MFA OTP templates to be properly converted to actual newlines in the template parsing.
What is the current behavior?
Currently, when users include
\n
in SMS or MFA phone OTP templates expecting newlines, these escaped newline characters are not converted to actual newlines. This means multi-line SMS templates don't work as expected.What is the new behavior?
The fix adds
strings.ReplaceAll(template, "\\n", "\n")
processing for both SMS and MFA phone templates before parsing. This allows users to include\n
in their template configuration and have it properly converted to actual newlines in the final SMS message.Additional context
This change affects both:
config.Sms.Template
)config.MFA.Phone.Template
)What kind of change does this PR introduce?
Bug fix - Allows newlines (\n) in SMS and MFA OTP templates to be properly converted to actual newlines in the template parsing.
What is the current behavior?
Currently, when users include
\n
in SMS or MFA phone OTP templates expecting newlines, these escaped newline characters are not converted to actual newlines. This means multi-line SMS templates don't work as expected.What is the new behavior?
The fix adds
strings.ReplaceAll(template, "\\n", "\n")
processing for both SMS and MFA phone templates before parsing. This allows users to include\n
in their template configuration and have it properly converted to actual newlines in the final SMS message.Additional context
This change affects both:
config.Sms.Template
)config.MFA.Phone.Template
)What kind of change does this PR introduce?
Bug fix - Allows newlines (\n) in SMS and MFA OTP templates to be properly converted to actual newlines.
What is the current behavior?
Currently, when users include
\n
in SMS or MFA phone OTP templates expecting newlines, these escaped newline characters are not converted to actual newlines. This means multi-line SMS templates don't work as expected.What is the new behavior?
This fix adds
strings.ReplaceAll(template, "\\n", "\n")
processing for both SMS and MFA phone templates before parsing. This allows users to include\n
in their template configuration and have it properly converted to actual newlines in the final SMS message.Additional context
This change affects both regular SMS templates (
config.Sms.Template
) and MFA phone templates (config.MFA.Phone.Template
). The fix is applied consistently to both template processing paths in thepopulateGlobal
function withininternal/conf/configuration.go
.The fix is applied consistently to both template processing paths in thepopulateGlobal
function withininternal/conf/configuration.go
.The fix is applied consistently to both template processing paths in thepopulateGlobal
function withininternal/conf/configuration.go
.## What kind of change does this PR introduce?Bug fix, feature, docs update, ...
What is the current behavior?
Please link any relevant issues here.
What is the new behavior?
Feel free to include screenshots if it includes visual changes.
Additional context
Add any other context or screenshots.