From dcbe1a266ab8c93f0bb05d7d7dfd89c3e1161111 Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Mon, 12 Feb 2024 16:35:08 +0100 Subject: [PATCH] Added Mail template to EmailSignup, Added localization resources --- Wave/Components/Pages/EmailSignup.razor | 19 ++- .../Components/Pages/EmailSignup.de-DE.resx | 125 +++++++++++++++++ .../Components/Pages/EmailSignup.en-GB.resx | 101 ++++++++++++++ .../Components/Pages/EmailSignup.resx | 131 ++++++++++++++++++ 4 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 Wave/Resources/Components/Pages/EmailSignup.de-DE.resx create mode 100644 Wave/Resources/Components/Pages/EmailSignup.en-GB.resx create mode 100644 Wave/Resources/Components/Pages/EmailSignup.resx diff --git a/Wave/Components/Pages/EmailSignup.razor b/Wave/Components/Pages/EmailSignup.razor index 66b2976..21cbe6a 100644 --- a/Wave/Components/Pages/EmailSignup.razor +++ b/Wave/Components/Pages/EmailSignup.razor @@ -5,11 +5,15 @@ @using System.ComponentModel.DataAnnotations @using Microsoft.AspNetCore.Identity.UI.Services @using Microsoft.EntityFrameworkCore +@using Wave.Services -@inject IOptions Features @inject IStringLocalizer Localizer @inject IDbContextFactory ContextFactory +@inject IOptions Features +@inject IOptions Customizations +@inject NavigationManager Navigation @inject IEmailSender EmailSender +@inject EmailTemplateService TemplateService @(TitlePrefix + Localizer["Title"]) @@ -70,7 +74,18 @@ await context.SaveChangesAsync(); if (subscriber.Unsubscribed) { - await EmailSender.SendEmailAsync(subscriber.Email, Localizer["ConfirmEmailSubject"], Localizer["ConfirmEmailBody"]); + string confirmLink = Navigation.ToAbsoluteUri("#").AbsoluteUri; // TODO + + var customization = Customizations.Value; + string body = TemplateService.Default( + Navigation.BaseUri, + !string.IsNullOrWhiteSpace(customization.LogoLink) ? + customization.LogoLink : + Navigation.ToAbsoluteUri("/img/logo.png").AbsoluteUri, + Localizer["ConfirmEmailTitle"], + string.Format(Localizer["ConfirmEmailBody"], customization.AppName) + + $"""

{Localizer["Submit"]}

"""); + await EmailSender.SendEmailAsync(subscriber.Email, Localizer["ConfirmEmailSubject"], body); } } diff --git a/Wave/Resources/Components/Pages/EmailSignup.de-DE.resx b/Wave/Resources/Components/Pages/EmailSignup.de-DE.resx new file mode 100644 index 0000000..9a871bb --- /dev/null +++ b/Wave/Resources/Components/Pages/EmailSignup.de-DE.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Abonnieren + + + Abonnieren + + + anna.muster@example.de + + + Anna Muster + + + Eine Bestätigungsmail wurde an ihren Posteingang geschickt (falls Sie nicht bereits angemeldet waren). + + + Bestätigen Sie Ihr Newsletter-Abonnement + + + Bitte folgen Sie dem folgendem Link um zu Bestätigen, dass Sie den Newsletter von {0} kostenfrei Abonnieren wollen. Wenn das nicht Sie waren können Sie diese E-Mail ignorieren. Sie können sich jederzeit abmelden. + + + E-Mail Bestätigen + + \ No newline at end of file diff --git a/Wave/Resources/Components/Pages/EmailSignup.en-GB.resx b/Wave/Resources/Components/Pages/EmailSignup.en-GB.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/Wave/Resources/Components/Pages/EmailSignup.en-GB.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Wave/Resources/Components/Pages/EmailSignup.resx b/Wave/Resources/Components/Pages/EmailSignup.resx new file mode 100644 index 0000000..04de437 --- /dev/null +++ b/Wave/Resources/Components/Pages/EmailSignup.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Subscribe + + + Name + + + John Doe + + + Email + + + john.doe@example.com + + + Subscribe + + + A mail has been send to your Inbox (if you are not already registered). + + + Confirm Email + + + Confirm your Newsletter Subscription + + + Please follow the following link to confirm that you want to subscribe to the newsletter of {0} for free. If this has not been you, you can ignore this Email. You can unsubscribe at any point. + + \ No newline at end of file