diff --git a/src/ContentRepository/ServicesComponent.cs b/src/ContentRepository/ServicesComponent.cs index 462be3880..0a7cd854f 100644 --- a/src/ContentRepository/ServicesComponent.cs +++ b/src/ContentRepository/ServicesComponent.cs @@ -1565,6 +1565,9 @@ Change your password builder.Patch("7.7.29", "7.7.30", "2023-06-09", "Upgrades sensenet content repository.") .Action(Patch_7_7_30); + + builder.Patch("7.7.30", "7.7.30.1", "2023-10-11", "Upgrades sensenet content repository.") + .Action(Patch_7_7_31); } private void Patch_7_7_29(PatchExecutionContext context) @@ -1832,6 +1835,108 @@ void ReplaceSelectionRoot(string contentTypeName, string fieldName) #endregion } + private void Patch_7_7_31(PatchExecutionContext context) + { + var logger = context.GetService>(); + + #region Content changes + + // email template for changed password + var changePassTemplate = Content.Load("/Root/System/Templates/Email/Registration/ChangePassword"); + if (changePassTemplate != null) + { + // update only if it has NOT changed after installation + var timeDiff = changePassTemplate.ModificationDate - changePassTemplate.CreationDate; + if (timeDiff.TotalSeconds < 1) + { + logger.LogInformation("Updating password change email template..."); + + changePassTemplate["Subject"] = "{FullName} - Please change your password in {RepositoryUrl}"; + changePassTemplate["Body"] = @" + + + + {FullName} - Please change your password in {RepositoryUrl} + + +
+
+
+ +
+
+

Welcome {LoginName}

+

Repository: {RepositoryUrl}

+
Before you log in with your user {LoginName}, please change your password.
+
If you did not create an account using this address ({Email}), please skip this mail.
+ + + + +
+ + + + +
+ + Change your password + +
+
+
+ Or using this link:
+ {ActionUrl} +
+
+
Thank you!
+
+
regards,
sensenet team
+
+
+
+
+ + + + + + +
+ + + + + + + + + + + +
+
+ Copyright © 2022 Sense/Net, All rights reserved. +
+
+
+
+ + +"; + changePassTemplate.SaveAsync(CancellationToken.None).GetAwaiter().GetResult(); + } + } + + #endregion + } + #region Patch template // ================================================================================================= diff --git a/src/Services.Core/Operations/IdentityOperations.cs b/src/Services.Core/Operations/IdentityOperations.cs index 0d09d4a4a..fb3003282 100644 --- a/src/Services.Core/Operations/IdentityOperations.cs +++ b/src/Services.Core/Operations/IdentityOperations.cs @@ -17,6 +17,7 @@ using SenseNet.Diagnostics; using SenseNet.Services.Core.Authentication; using SenseNet.Storage.Security; +using StringExtensions = SenseNet.Client.StringExtensions; using Task = System.Threading.Tasks.Task; namespace SenseNet.Services.Core.Operations @@ -493,8 +494,9 @@ public static async Task SendChangePasswordMail(Content content, HttpContext htt { p["Email"] = email; p["Username"] = email; + p["LoginName"] = user.LoginName; p["FullName"] = fullName; - p["RepositoryUrl"] = repositoryUrl; + p["RepositoryUrl"] = StringExtensions.TrimSchema(repositoryUrl); p["ActionUrl"] = actionUrl; return Task.CompletedTask; diff --git a/src/nuget/snadmin/install-services/import/System/Templates/Email/Registration/ChangePassword.Content b/src/nuget/snadmin/install-services/import/System/Templates/Email/Registration/ChangePassword.Content index 24a5658c6..b621d5718 100644 --- a/src/nuget/snadmin/install-services/import/System/Templates/Email/Registration/ChangePassword.Content +++ b/src/nuget/snadmin/install-services/import/System/Templates/Email/Registration/ChangePassword.Content @@ -3,13 +3,13 @@ EmailTemplate ChangePassword - sensenet - Please change your password! + {FullName} - Please change your password in {RepositoryUrl} - + {FullName} - Please change your password in {RepositoryUrl}
@@ -23,8 +23,9 @@ sensenet logo
-

Welcome to sensenet!

-
Before you log in, please change your password.
+

Welcome {LoginName}

+

Repository: {RepositoryUrl}

+
Before you log in with your user {LoginName}, please change your password.
If you did not create an account using this address ({Email}), please skip this mail.
@@ -62,7 +63,7 @@ @@ -71,11 +72,6 @@ -
- + - - - -