commit 331310c63bfd00b3eeb4eae8b25e51eabe46c10f
Author: Dominik Chlouba <dchlouba@students.zcu.cz>
Date:   Tue Jun 1 20:47:18 2021 +0200

    Implementatio of SMTP and SendGrid email services, email templating, base template value object

diff --git a/Leuze.sln b/Leuze.sln
index 150e6c5..50784a6 100644
--- a/Leuze.sln
+++ b/Leuze.sln
@@ -53,6 +53,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Modules.Goal.Domain",
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Modules.Goal.Infrastructure.Persistence", "src\Modules\Goal\Infrastructure\Leuze.Modules.Goal.Infrastructure.Persistence\Leuze.Modules.Goal.Infrastructure.Persistence.csproj", "{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Core.Infrastructure.Email", "src\Core\Infrastructure\Leuze.Core.Infrastructure.Email\Leuze.Core.Infrastructure.Email.csproj", "{A54445C7-26EC-4314-B64E-A08B02A46B6E}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -111,6 +113,10 @@ Global
 		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A54445C7-26EC-4314-B64E-A08B02A46B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A54445C7-26EC-4314-B64E-A08B02A46B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A54445C7-26EC-4314-B64E-A08B02A46B6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A54445C7-26EC-4314-B64E-A08B02A46B6E}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -137,6 +143,7 @@ Global
 		{C6F9EFF2-30DA-4FA9-AEFF-4957F0260267} = {1AEE9C09-804F-4AF7-B966-80830B39C85F}
 		{BAAC1AB6-C671-408C-94EF-96459D5403DD} = {4A441C7D-2659-4FB5-8886-420728C229BF}
 		{BEBFBA58-BCB7-4F44-9247-EAAAE748176A} = {E4134FEF-ECBC-4EEF-A65B-8E8D318DA8DA}
+		{A54445C7-26EC-4314-B64E-A08B02A46B6E} = {6A0F1F61-D0EB-4132-B722-5787D7046CC0}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {849C3668-1CB9-4F98-ADFA-A71F5629384C}
diff --git a/src/Core/Application/Leuze.Core.Application.UI/Components/Login/Form.razor b/src/Core/Application/Leuze.Core.Application.UI/Components/Login/Form.razor
index 85ac69d..6556173 100644
--- a/src/Core/Application/Leuze.Core.Application.UI/Components/Login/Form.razor
+++ b/src/Core/Application/Leuze.Core.Application.UI/Components/Login/Form.razor
@@ -1,5 +1,6 @@
 ﻿@inject IMediator _mediator
 @inject NavigationManager _navManager
+@inject IToastService toastService
 @inject IStringLocalizer<Form> T
 
 <Styled @bind-Classname="@_form">
@@ -132,12 +133,17 @@
 
     private async Task Change()
     {
-        /*var result = await _mediator.Send(new VerifyLocalUser.Command(Email, Password));
+        _navManager.TryGetQueryString<string>("token", out var token);
+        _navManager.TryGetQueryString<string>("user", out var user);
+        token = token.Replace(" ", "+");
+        var result = await _mediator.Send(new ResetLocalUserPassword.Command(user, token, Password));
 
         if (!result.IsSuccess) Error = result.Errors.First();
-        else _navManager.NavigateTo("/");*/
-
-        //TODO: Change password
+        else
+        {
+            toastService.ShowSuccess("Heslo úspěšně nastaveno");
+            _navManager.NavigateTo("/");
+        }
 
     }
 
diff --git a/src/Core/Application/Leuze.Core.Application.UI/Extensions/NavigationManagerExtensions.cs b/src/Core/Application/Leuze.Core.Application.UI/Extensions/NavigationManagerExtensions.cs
new file mode 100644
index 0000000..ac2d1cc
--- /dev/null
+++ b/src/Core/Application/Leuze.Core.Application.UI/Extensions/NavigationManagerExtensions.cs
@@ -0,0 +1,44 @@
+﻿using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.WebUtilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Leuze.Core.Application.UI.Extensions
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public static class NavigationManagerExtensions
+    {
+        public static bool TryGetQueryString<T>(this NavigationManager navManager, string key, out T value)
+        {
+            var uri = navManager.ToAbsoluteUri(navManager.Uri);
+
+            if (QueryHelpers.ParseQuery(uri.Query).TryGetValue(key, out var valueFromQueryString))
+            {
+                if (typeof(T) == typeof(int) && int.TryParse(valueFromQueryString, out var valueAsInt))
+                {
+                    value = (T)(object)valueAsInt;
+                    return true;
+                }
+
+                if (typeof(T) == typeof(string))
+                {
+                    value = (T)(object)valueFromQueryString.ToString();
+                    return true;
+                }
+
+                if (typeof(T) == typeof(decimal) && decimal.TryParse(valueFromQueryString, out var valueAsDecimal))
+                {
+                    value = (T)(object)valueAsDecimal;
+                    return true;
+                }
+            }
+
+            value = default;
+            return false;
+        }
+    }
+}
diff --git a/src/Core/Application/Leuze.Core.Application.UI/_Imports.razor b/src/Core/Application/Leuze.Core.Application.UI/_Imports.razor
index 0b926f7..84041db 100644
--- a/src/Core/Application/Leuze.Core.Application.UI/_Imports.razor
+++ b/src/Core/Application/Leuze.Core.Application.UI/_Imports.razor
@@ -36,4 +36,5 @@
 @using ChartJs.Blazor.Common.Handlers
 @using ChartJs.Blazor.Common.Time
 @using ChartJs.Blazor.Util
+@using Leuze.Core.Application.UI.Extensions
 @using ChartJs.Blazor.Interop
\ No newline at end of file
diff --git a/src/Core/Application/Leuze.Core.Application/CQRS/Users/Commands/CreateLocalUser.cs b/src/Core/Application/Leuze.Core.Application/CQRS/Users/Commands/CreateLocalUser.cs
index be5f15b..c6707b3 100644
--- a/src/Core/Application/Leuze.Core.Application/CQRS/Users/Commands/CreateLocalUser.cs
+++ b/src/Core/Application/Leuze.Core.Application/CQRS/Users/Commands/CreateLocalUser.cs
@@ -2,14 +2,16 @@
 using Leuze.Core.Application.Identity;
 using Leuze.Core.Domain.Domains.Users;
 using Leuze.Core.Domain.Repositories;
+using Leuze.Core.Domain.Services;
+using Leuze.Core.Domain.Services.Models.Email;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNetCore.Identity.UI.Services;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Options;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Mail;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -41,19 +43,22 @@ namespace Leuze.Core.Application.CQRS.Users.Commands
             private readonly RoleManager<ApplicationRole> _roleManager;
             private readonly AppSettings _appSettings;
             private readonly IHttpContextAccessor _httpContextAccessor;
+            private readonly IEmailSender _emailSender;
 
             /// <summary>
             /// 
             /// </summary>
             /// <param name="domainUserRepository"></param>
             /// <param name="userManager"></param>
+            /// <param name="roleManager"></param>
             /// <param name="options"></param>
             /// <param name="httpContextAccessor"></param>
             /// <param name="userRepository"></param>
+            /// <param name="emailSender"></param>
             public Handler(IDomainUserRepository domainUserRepository, UserManager<ApplicationUser> userManager, RoleManager<ApplicationRole> roleManager,
-                IOptions<AppSettings> options, IHttpContextAccessor httpContextAccessor, IUserRepository userRepository)
-                => (_domainUserRepository, _userManager, _appSettings, _httpContextAccessor, _userRepository, _roleManager)
-                        = (domainUserRepository, userManager, options.Value, httpContextAccessor, userRepository, roleManager);
+                IOptions<AppSettings> options, IHttpContextAccessor httpContextAccessor, IUserRepository userRepository, IEmailSender emailSender)
+                => (_domainUserRepository, _userManager, _appSettings, _httpContextAccessor, _userRepository, _roleManager, _emailSender)
+                        = (domainUserRepository, userManager, options.Value, httpContextAccessor, userRepository, roleManager, emailSender);
 
             /// <summary>
             /// 
@@ -85,12 +90,12 @@ namespace Leuze.Core.Application.CQRS.Users.Commands
 
                 var resetToken = await _userManager.GeneratePasswordResetTokenAsync(user);
 
-                /*await _emailSender.SendAsync(new NewUserTemplate(
+                await _emailSender.SendAsync(new NewUserTemplate(
                     null!,
-                    new MailAddress(domainUser.Email.GetEmailAddress()),
+                    new MailAddress(domainUser.EmailAddress.Email),
                     "Vytvořen účet - Leuze",
-                    new() { ResetLink = $"{_httpContextAccessor.HttpContext!.Request.Scheme}://{_httpContextAccessor.HttpContext!.Request.Host}/{_appSettings.Authentication.ResetUrl}/?token={resetToken}&user={user.Email}" }
-                ));*/
+                    new() { ResetLink = $"{_httpContextAccessor.HttpContext!.Request.Scheme}://{_httpContextAccessor.HttpContext!.Request.Host}/{_appSettings.ResetUrl}/?token={resetToken}&user={user.Email}" }
+                ));
 
                 return RequestResponse<Response>.CreateSuccessResponse(new(resetToken));
             }
diff --git a/src/Core/Application/Leuze.Core.Application/Configuration/AppSettings.cs b/src/Core/Application/Leuze.Core.Application/Configuration/AppSettings.cs
index 41a901a..2b72349 100644
--- a/src/Core/Application/Leuze.Core.Application/Configuration/AppSettings.cs
+++ b/src/Core/Application/Leuze.Core.Application/Configuration/AppSettings.cs
@@ -16,6 +16,11 @@
         /// </summary>
         public EncryptionSection Encryption { get; set; } = new();
 
+        /// <summary>
+        /// 
+        /// </summary>
+        public string ResetUrl { get; set; } = null!;
+
         /// <summary>
         /// 
         /// </summary>
diff --git a/src/Core/Domain/Leuze.Core.Domain/Leuze.Core.Domain.csproj b/src/Core/Domain/Leuze.Core.Domain/Leuze.Core.Domain.csproj
index ba2e7f0..f01c07c 100644
--- a/src/Core/Domain/Leuze.Core.Domain/Leuze.Core.Domain.csproj
+++ b/src/Core/Domain/Leuze.Core.Domain/Leuze.Core.Domain.csproj
@@ -22,14 +22,13 @@
     <PackageReference Include="ExtCore.Data.Abstractions" Version="6.0.0" />
     <PackageReference Include="ExtCore.Data.Entities.Abstractions" Version="6.0.0" />
     <PackageReference Include="MediatR" Version="9.0.0" />
+    <PackageReference Include="FluentEmail.Razor" Version="3.0.0" />
+    <PackageReference Include="FluentEmail.SendGrid" Version="3.0.0" />
+    <PackageReference Include="FluentEmail.Smtp" Version="3.0.0" />
   </ItemGroup>
 
   <ItemGroup>
     <ProjectReference Include="..\..\Application\Leuze.Core.Application.Identity\Leuze.Core.Application.Identity.csproj" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Folder Include="Services\" />
-  </ItemGroup>
-
 </Project>
diff --git a/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/NewUserTemplate.cs b/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/NewUserTemplate.cs
new file mode 100644
index 0000000..80c8c08
--- /dev/null
+++ b/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/NewUserTemplate.cs
@@ -0,0 +1,41 @@
+﻿using System.Net.Mail;
+
+namespace Leuze.Core.Domain.Services.Models.Email
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class NewUserTemplate : BaseEmailTemplate<NewUserTemplateValues>
+    {
+
+        private static string TEMPLATE_FILE = "NewUserTemplate.cshtml";
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="from"></param>
+        /// <param name="to"></param>
+        /// <param name="subject"></param>
+        /// <param name="values"></param>
+        public NewUserTemplate(
+            MailAddress from,
+            MailAddress to,
+            string subject,
+            NewUserTemplateValues values
+        ) : base(from, to, subject, values, TEMPLATE_FILE)
+        {
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    public sealed record NewUserTemplateValues
+    {
+        /// <summary>
+        /// /
+        /// </summary>
+        public string ResetLink { get; set; } = null!;
+
+    }
+}
diff --git a/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/ResetPasswordTemplate.cs b/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/ResetPasswordTemplate.cs
new file mode 100644
index 0000000..ad768f5
--- /dev/null
+++ b/src/Core/Domain/Leuze.Core.Domain/Services/Models/Email/ResetPasswordTemplate.cs
@@ -0,0 +1,26 @@
+﻿using System.Net.Mail;
+
+namespace Leuze.Core.Domain.Services.Models.Email
+{
+    public class ResetPasswordTemplate : BaseEmailTemplate<ResetPasswordTemplateValues>
+    {
+
+        public static string WIZARD_SHORT_LINK_TEMPLATE_FILE = "ResetPasswordTemplate.cshtml";
+
+        public ResetPasswordTemplate(
+            MailAddress from,
+            MailAddress to,
+            string subject,
+            ResetPasswordTemplateValues values
+        ) : base(from, to, subject, values, WIZARD_SHORT_LINK_TEMPLATE_FILE)
+        {
+        }
+    }
+
+    public sealed record ResetPasswordTemplateValues
+    {
+
+        public string ResetLink { get; set; } = null!;
+
+    }
+}
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Configuration/EmailSettings.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Configuration/EmailSettings.cs
index 4220770..a211f23 100644
--- a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Configuration/EmailSettings.cs
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Configuration/EmailSettings.cs
@@ -10,11 +10,21 @@
         /// </summary>
         public SmtpSection Smtp { get; set; } = new();
 
+        /// <summary>
+        /// 
+        /// </summary>
+        public SendGridSection SendGrid { get; set; } = new();
+
         /// <summary>
         ///     Specifies email template root path.
         /// </summary>
         public string AdminEmailAddress { get; set; } = null!;
 
+        /// <summary>
+        /// 
+        /// </summary>
+        public bool UseSendGrid { get; set; } = false;
+
         /// <summary>
         ///     A wrapper class for <see cref="EmailSettings" /> Smtp configuration section.
         /// </summary>
@@ -40,5 +50,18 @@
             /// </summary>
             public int Port { get; set; }
         }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        public sealed class SendGridSection
+        {
+
+            /// <summary>
+            /// 
+            /// </summary>
+            public string ApiKey { get; set; } = null!;
+
+        }
     }
 }
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Extensions/EmailProviderExtension.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Extensions/EmailProviderExtension.cs
index ebf1785..a0c8d92 100644
--- a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Extensions/EmailProviderExtension.cs
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Extensions/EmailProviderExtension.cs
@@ -17,18 +17,24 @@ namespace Leuze.Core.Infrastructure.Email.Extensions
         /// <param name="emailSettings"></param>
         public static void AddEmailProvider(this IServiceCollection services, EmailSettings emailSettings)
         {
-            services
-                .AddFluentEmail(emailSettings.AdminEmailAddress)
-                .AddSmtpSender(new SmtpClient()
+            services.AddScoped((services) =>
+            {
+                return new SmtpClient()
                 {
                     Host = emailSettings.Smtp.Host,
                     Port = emailSettings.Smtp.Port,
                     EnableSsl = true,
                     Credentials = new NetworkCredential(emailSettings.Smtp.User, emailSettings.Smtp.Password)
-                })
+                };
+            });
+
+            services
+                .AddFluentEmail(emailSettings.AdminEmailAddress)
+                .AddSendGridSender(emailSettings.SendGrid.ApiKey, false)
                 .AddRazorRenderer($"{Directory.GetCurrentDirectory()}/");
 
-            services.AddScoped<IEmailSender, SmtpSender>();
+            if(emailSettings.UseSendGrid) services.AddScoped<IEmailSender, SendGridSender>();
+            else services.AddScoped<IEmailSender, SmtpSender>();
         }
 
     }
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Leuze.Core.Infrastructure.Email.csproj b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Leuze.Core.Infrastructure.Email.csproj
index d32eb42..eed50d1 100644
--- a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Leuze.Core.Infrastructure.Email.csproj
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Leuze.Core.Infrastructure.Email.csproj
@@ -21,6 +21,7 @@
   <ItemGroup>
     <PackageReference Include="ExtCore.Infrastructure" Version="6.0.0" />
     <PackageReference Include="FluentEmail.Razor" Version="3.0.0" />
+    <PackageReference Include="FluentEmail.SendGrid" Version="3.0.0" />
     <PackageReference Include="FluentEmail.Smtp" Version="3.0.0" />
   </ItemGroup>
   
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SendGridSender.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SendGridSender.cs
new file mode 100644
index 0000000..b82cbe1
--- /dev/null
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SendGridSender.cs
@@ -0,0 +1,62 @@
+﻿using FluentEmail.Core;
+using Leuze.Core.Domain.Services;
+using Leuze.Core.Domain.Services.Models.Email;
+using Leuze.Core.Infrastructure.Email.Configuration;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Mail;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Leuze.Core.Infrastructure.Email.Services
+{
+    public class SendGridSender : IEmailSender
+    {
+        private readonly IFluentEmail _fluentEmail;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        private readonly EmailSettings _emailSettings;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="options"></param>
+        /// <param name="fluentEmail"></param>
+        public SendGridSender(
+            IOptions<EmailSettings> options,
+            IFluentEmail fluentEmail
+        )
+        {
+            _fluentEmail = fluentEmail;
+            _emailSettings = options.Value;
+        }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public MailAddress GetAdminEmailAddress() => new MailAddress(_emailSettings.AdminEmailAddress);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <typeparam name="TValuesType"></typeparam>
+        /// <param name="template"></param>
+        /// <returns></returns>
+        public async Task SendAsync<TValuesType>(BaseEmailTemplate<TValuesType> template)
+        {
+            if (template.To is not null)
+            {
+                _fluentEmail.To(template.To.Address);
+                _fluentEmail.Subject(template.Subject);
+                _fluentEmail.UsingTemplateFromFile($"Templates/{template.TemplatePath}", template.Values);
+
+                await _fluentEmail.SendAsync();
+            }
+        }
+    }
+}
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SmtpSender.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SmtpSender.cs
index 1fd0d36..3b0727e 100644
--- a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SmtpSender.cs
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Email/Services/SmtpSender.cs
@@ -27,11 +27,16 @@ namespace Leuze.Core.Infrastructure.Email.Services
         /// 
         /// </summary>
         /// <param name="smtpClient"></param>
-        /// <param name="renderer"></param>
         /// <param name="options"></param>
-        public SmtpSender(SmtpClient smtpClient, RazorRenderer renderer, IOptions<EmailSettings> options) : base(smtpClient) 
-            => (FluentEmail.Core.Email.DefaultSender, FluentEmail.Core.Email.DefaultRenderer, _emailSettings) 
-                = (this, renderer, options.Value);
+        public SmtpSender(
+            SmtpClient smtpClient,
+            IOptions<EmailSettings> options
+        ) : base(smtpClient)
+        {
+            FluentEmail.Core.Email.DefaultSender = this;
+            FluentEmail.Core.Email.DefaultRenderer = new RazorRenderer();
+            _emailSettings = options.Value;
+        }
 
         /// <summary>
         /// 
@@ -49,7 +54,7 @@ namespace Leuze.Core.Infrastructure.Email.Services
             await FluentEmail.Core.Email.From(template.From is not null ? template.From.Address : _emailSettings.AdminEmailAddress)
                 .To(template.To is not null ? template.To.Address : _emailSettings.AdminEmailAddress)
                 .Subject(template.Subject)
-                .UsingTemplateFromFile($"Templates/{template.TemplatePath}", template.Values)
+                .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Templates/{template.TemplatePath}", template.Values)
                 .SendAsync();
         }
 
diff --git a/src/Presentation/Leuze.App/Leuze.App.csproj b/src/Presentation/Leuze.App/Leuze.App.csproj
index d905b63..70627fb 100644
--- a/src/Presentation/Leuze.App/Leuze.App.csproj
+++ b/src/Presentation/Leuze.App/Leuze.App.csproj
@@ -12,6 +12,8 @@
     <Nullable>enable</Nullable>
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
     <UserSecretsId>61d7eb1b-7e84-4d33-bf02-87517697a10c</UserSecretsId>
+    <PreserveCompilationReferences>true</PreserveCompilationReferences>
+    <PreserveCompilationContext>true</PreserveCompilationContext>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
diff --git a/src/Presentation/Leuze.App/Templates/NewUserTemplate.cshtml b/src/Presentation/Leuze.App/Templates/NewUserTemplate.cshtml
new file mode 100644
index 0000000..1f37721
--- /dev/null
+++ b/src/Presentation/Leuze.App/Templates/NewUserTemplate.cshtml
@@ -0,0 +1,5 @@
+﻿@{
+    <p>Nový účet vytvořen. Nastavte si heslo: </p>
+    <p>@Model.ResetLink</p>
+
+}
\ No newline at end of file
diff --git a/src/Presentation/Leuze.App/Templates/ResetPasswordTemplate.cshtml b/src/Presentation/Leuze.App/Templates/ResetPasswordTemplate.cshtml
new file mode 100644
index 0000000..83f0c2a
--- /dev/null
+++ b/src/Presentation/Leuze.App/Templates/ResetPasswordTemplate.cshtml
@@ -0,0 +1,5 @@
+﻿@{
+
+    <p>@Model.ResetLink</p>
+
+}
\ No newline at end of file
diff --git a/src/Presentation/Leuze.App/appsettings.Development.json b/src/Presentation/Leuze.App/appsettings.Development.json
index 85404ff..3e28422 100644
--- a/src/Presentation/Leuze.App/appsettings.Development.json
+++ b/src/Presentation/Leuze.App/appsettings.Development.json
@@ -20,15 +20,6 @@
       "IV": "GY1dGVtY9bKReyFi"
     }
   },
-  "Email": {
-    "Smtp": {
-      "Host": "",
-      "User": "",
-      "Password": "",
-      "Port": 587
-    },
-    "AdminEmailAddress": ""
-  },
   "Serilog": {
     "Using": [],
     "MinimumLevel": {
diff --git a/src/Presentation/Leuze.App/appsettings.json b/src/Presentation/Leuze.App/appsettings.json
index 9829407..a0d8468 100644
--- a/src/Presentation/Leuze.App/appsettings.json
+++ b/src/Presentation/Leuze.App/appsettings.json
@@ -18,7 +18,8 @@
     "Encryption": {
       "Key": "GY1dGVtY9bKReyFiGap1Ba7zKbZGvZWZ",
       "IV": "GY1dGVtY9bKReyFi"
-    }
+    },
+    "ResetUrl": "Identity/Account/ResetPassword"
   },
   "Email": {
     "Smtp": {
@@ -27,7 +28,11 @@
       "Password": "",
       "Port": 587
     },
-    "AdminEmailAddress": ""
+    "SendGrid": {
+      "ApiKey": ""
+    },
+    "UseSendGrid": false,
+    "AdminEmailAddress": "hello@leuze.com"
   },
   "Serilog": {
     "Using": [],
