diff --git a/FoodsharingSiegen.Server/Auth/AuthService.cs b/FoodsharingSiegen.Server/Auth/AuthService.cs index c85531c..61aab8b 100644 --- a/FoodsharingSiegen.Server/Auth/AuthService.cs +++ b/FoodsharingSiegen.Server/Auth/AuthService.cs @@ -2,11 +2,13 @@ using FoodsharingSiegen.Contracts; using FoodsharingSiegen.Contracts.Entity; using FoodsharingSiegen.Contracts.Enums; using FoodsharingSiegen.Contracts.Helper; +using FoodsharingSiegen.Contracts.Model; using FoodsharingSiegen.Server.Data; using FoodsharingSiegen.Server.Service; using FoodsharingSiegen.Shared.Helper; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Options; namespace FoodsharingSiegen.Server.Auth { @@ -55,6 +57,11 @@ namespace FoodsharingSiegen.Server.Auth /// private readonly IMailService _mailService; + /// + /// The application settings + /// + private readonly AppSettings _appSettings; + #endregion #region Setup/Teardown @@ -70,12 +77,14 @@ namespace FoodsharingSiegen.Server.Auth FsContext context, LocalStorageService localStorageService, AuthenticationStateProvider authenticationStateProvider, - IMailService mailService) + IMailService mailService, + IOptions appSettings) { Context = context; _localStorageService = localStorageService; _authenticationStateProvider = authenticationStateProvider; _mailService = mailService; + _appSettings = appSettings.Value; } #endregion @@ -211,7 +220,17 @@ namespace FoodsharingSiegen.Server.Auth await Context.SaveChangesAsync(); var resetLink = $"{baseUri.TrimEnd('/')}/reset-password/{resetToken}"; - var mailBody = $"Hallo {user.Name},

Um dein Passwort zurückzusetzen, klicke bitte auf den folgenden Link (dieser ist 30 Minuten gültig):
{resetLink}

Viele Grüße
Dein Foodsharing Team"; + var mailBody = $""" + Hallo {user.Name},
+
+ für dein Konto wurde eine Anfrage zum Zurücksetzen des Passworts gestellt.
+ Wenn du diese Anfrage nicht gestellt hast, kannst du diese E-Mail ignorieren und dein Passwort bleibt unverändert.
+
+ Um dein Passwort zurückzusetzen, klicke bitte auf den folgenden Link (dieser ist 30 Minuten gültig):
+ {resetLink}
+
+ Viele Grüße
Dein Team {_appSettings.Terms.Title} + """; await _mailService.SendEmailAsync(user.Mail, "Passwort zurücksetzen", mailBody); }