From 2e66129485d010070c4bfeb6cf681a5d72078349 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 16 May 2024 16:40:38 +0200 Subject: [PATCH 01/30] =?UTF-8?q?DTO=20f=C3=BCr=20EnvelopeHistory-Erstellu?= =?UTF-8?q?ng=20hinzugef=C3=BCgt,=20asynchrone=20Record-Methode=20implemen?= =?UTF-8?q?tiert=20und=20Datenbank-Trigger=20f=C3=BCr=20Envelope-=20und=20?= =?UTF-8?q?EnvelopeHistory-Entit=C3=A4ten=20konfiguriert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IEnvelopeHistoryService.cs | 7 +++++-- EnvelopeGenerator.Application/DTOs/EnvelopeDto.cs | 1 + .../DTOs/EnvelopeHistory/EnvelopeHistoryCreateDto.cs | 8 ++++++++ .../DTOs/{ => EnvelopeHistory}/EnvelopeHistoryDto.cs | 2 +- .../MappingProfiles/BasicDtoMappingProfile.cs | 3 +++ .../Services/EnvelopeHistoryService.cs | 12 ++++++++++-- EnvelopeGenerator.Domain/Entities/EnvelopeHistory.cs | 1 + EnvelopeGenerator.Infrastructure/EGDbContext.cs | 12 +++--------- EnvelopeGenerator.Web/Controllers/HomeController.cs | 9 ++++----- .../Test/TestEnvelopeHistoryController.cs | 4 ++-- EnvelopeGenerator.Web/appsettings.json | 2 +- 11 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryCreateDto.cs rename EnvelopeGenerator.Application/DTOs/{ => EnvelopeHistory}/EnvelopeHistoryDto.cs (74%) diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs index 8883160e..6a1f4eda 100644 --- a/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs @@ -1,17 +1,20 @@ using DigitalData.Core.Contracts.Application; -using EnvelopeGenerator.Application.DTOs; +using DigitalData.Core.DTO; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Application.Contracts { - public interface IEnvelopeHistoryService : IBasicCRUDService + public interface IEnvelopeHistoryService : ICRUDService { Task CountAsync(int? envelopeId = null, string? userReference = null, int? status = null); Task AccessCodeAlreadyRequested(int envelopeId, string userReference); Task IsSigned(int envelopeId, string userReference); + + Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/DTOs/EnvelopeDto.cs b/EnvelopeGenerator.Application/DTOs/EnvelopeDto.cs index eab0d471..3b1cc6db 100644 --- a/EnvelopeGenerator.Application/DTOs/EnvelopeDto.cs +++ b/EnvelopeGenerator.Application/DTOs/EnvelopeDto.cs @@ -1,4 +1,5 @@ using DigitalData.UserManager.Domain.Entities; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; using EnvelopeGenerator.Domain.Entities; namespace EnvelopeGenerator.Application.DTOs diff --git a/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryCreateDto.cs b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryCreateDto.cs new file mode 100644 index 00000000..2999935d --- /dev/null +++ b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryCreateDto.cs @@ -0,0 +1,8 @@ +namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory +{ + public record EnvelopeHistoryCreateDto( + int EnvelopeId, + string UserReference, + int Status, + DateTime? ActionDate); +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/DTOs/EnvelopeHistoryDto.cs b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs similarity index 74% rename from EnvelopeGenerator.Application/DTOs/EnvelopeHistoryDto.cs rename to EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs index 8efd12e1..8f242bc0 100644 --- a/EnvelopeGenerator.Application/DTOs/EnvelopeHistoryDto.cs +++ b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs @@ -1,4 +1,4 @@ -namespace EnvelopeGenerator.Application.DTOs +namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory { public record EnvelopeHistoryDto( long Id, diff --git a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs b/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs index cd7304f7..b271c472 100644 --- a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs +++ b/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs @@ -1,5 +1,6 @@ using AutoMapper; using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; using EnvelopeGenerator.Domain.Entities; namespace EnvelopeGenerator.Application.MappingProfiles @@ -17,6 +18,7 @@ namespace EnvelopeGenerator.Application.MappingProfiles CreateMap(); CreateMap(); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); @@ -32,6 +34,7 @@ namespace EnvelopeGenerator.Application.MappingProfiles CreateMap(); CreateMap(); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs index fb8d3c77..94fdd471 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs @@ -2,15 +2,16 @@ using DigitalData.Core.Application; using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; -using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using static EnvelopeGenerator.Common.Constants; using EnvelopeGenerator.Application.Resources; +using DigitalData.Core.DTO; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; namespace EnvelopeGenerator.Application.Services { - public class EnvelopeHistoryService : BasicCRUDService, IEnvelopeHistoryService + public class EnvelopeHistoryService : CRUDService, IEnvelopeHistoryService { public EnvelopeHistoryService(IEnvelopeHistoryRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper) @@ -33,5 +34,12 @@ namespace EnvelopeGenerator.Application.Services envelopeId: envelopeId, userReference: userReference, status: (int) EnvelopeStatus.DocumentSigned) > 0; + + public async Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status) => + await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now)) + .ThenAsync( + Success: id => Result.Success(id), + Fail: (mssg, ntc) => Result.Fail().Message(mssg).Notice(ntc) + ); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Domain/Entities/EnvelopeHistory.cs b/EnvelopeGenerator.Domain/Entities/EnvelopeHistory.cs index 20ee71bc..ada07298 100644 --- a/EnvelopeGenerator.Domain/Entities/EnvelopeHistory.cs +++ b/EnvelopeGenerator.Domain/Entities/EnvelopeHistory.cs @@ -25,6 +25,7 @@ namespace EnvelopeGenerator.Domain.Entities [Required] [Column("ADDED_WHEN", TypeName = "datetime")] + [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public DateTime AddedWhen { get; set; } [Column("ACTION_DATE", TypeName = "datetime")] diff --git a/EnvelopeGenerator.Infrastructure/EGDbContext.cs b/EnvelopeGenerator.Infrastructure/EGDbContext.cs index eb5c053c..1a910bcb 100644 --- a/EnvelopeGenerator.Infrastructure/EGDbContext.cs +++ b/EnvelopeGenerator.Infrastructure/EGDbContext.cs @@ -33,11 +33,6 @@ namespace DigitalData.UserManager.Infrastructure.Repositories .WithOne() .HasForeignKey(ed => ed.EnvelopeId); - //modelBuilder.Entity() - // .HasMany(e => e.Receivers) - // .WithOne(er => er.Envelope) - // .HasForeignKey(er => er.EnvelopeId); - modelBuilder.Entity() .HasMany(e => e.History) .WithOne() @@ -53,10 +48,9 @@ namespace DigitalData.UserManager.Infrastructure.Repositories .WithMany(ed => ed.Elements) .HasForeignKey(dre => dre.DocumentId); - //modelBuilder.Entity() - // .HasMany(e => e.EnvelopeReceivers) - // .WithOne(er => er.Receiver) - // .HasForeignKey(er => er.ReceiverId); + // Configure entities to handle database triggers + modelBuilder.Entity().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS")); + modelBuilder.Entity().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS")); base.OnModelCreating(modelBuilder); } diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index 52fbab73..27700489 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -56,8 +56,8 @@ namespace EnvelopeGenerator.Web.Controllers bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress); if (!accessCodeAlreadyRequested) { - // Send email with password - bool actionResult = database.Services.actionService.RequestAccessCode(response.Envelope, response.Receiver); + await _historyService.RecordAsync(er.EnvelopeId, er.Receiver.EmailAddress, Constants.EnvelopeStatus.AccessCodeRequested); + bool result = database.Services.emailService.SendDocumentAccessCodeReceivedEmail(response.Envelope, response.Receiver); } @@ -89,13 +89,12 @@ namespace EnvelopeGenerator.Web.Controllers UserLanguage = _cultures.Default.Language; return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}"); } - - if (UserLanguage is not null && culture is not null) + else if (UserLanguage is not null && culture is not null) { return Redirect($"Locked"); } - ViewData["UserLanguage"] = UserLanguage; + ViewData["UserLanguage"] = UserLanguage ?? culture; return await _envRcvService.IsExisting(envelopeReceiverId: envelopeReceiverId).ThenAsync( Success: isExisting => isExisting ? View().WithData("EnvelopeKey", envelopeReceiverId) : this.ViewEnvelopeNotFound(), diff --git a/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeHistoryController.cs b/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeHistoryController.cs index 8ecab4bd..3fb439c7 100644 --- a/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeHistoryController.cs +++ b/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeHistoryController.cs @@ -1,13 +1,13 @@ using DigitalData.Core.API; using EnvelopeGenerator.Application.Contracts; -using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Application.DTOs.EnvelopeHistory; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using Microsoft.AspNetCore.Mvc; namespace EnvelopeGenerator.Web.Controllers.Test { - public class TestEnvelopeHistoryController : TestControllerBase + public class TestEnvelopeHistoryController : CRUDControllerBase { public TestEnvelopeHistoryController(ILogger logger, IEnvelopeHistoryService service) : base(logger, service) { diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index d8779239..90e35de5 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -19,7 +19,7 @@ }, "PSPDFKitLicenseKey": null, /* The first format parameter {0} will be replaced by the nonce value. */ - "TestCSP": true, + "TestCSP": false, "Content-Security-Policy": [ "default-src 'self'", "script-src 'self' 'nonce-{0}' 'unsafe-inline' 'unsafe-eval' blob: data:", From bc6972bcfbfba5f2f156be53689f9a366afe3265 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 17 May 2024 13:59:40 +0200 Subject: [PATCH 02/30] =?UTF-8?q?ReadByName=20in=20EmailTemplate=20Reposit?= =?UTF-8?q?roy=20und=20Dienst=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IEmailTemplateService.cs | 3 +++ EnvelopeGenerator.Application/Key.cs | 23 ++++++++++--------- .../Services/EmailTemplateService.cs | 13 +++++++++++ .../Contracts/IEmailTemplateRepository.cs | 2 ++ .../Repositories/EmailTemplateRepository.cs | 4 ++++ .../Test/TestEmailTemplateController.cs | 22 +++++++++++++++++- 6 files changed, 55 insertions(+), 12 deletions(-) diff --git a/EnvelopeGenerator.Application/Contracts/IEmailTemplateService.cs b/EnvelopeGenerator.Application/Contracts/IEmailTemplateService.cs index 8151916e..eb497f44 100644 --- a/EnvelopeGenerator.Application/Contracts/IEmailTemplateService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEmailTemplateService.cs @@ -1,11 +1,14 @@ using DigitalData.Core.Contracts.Application; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Application.Contracts { public interface IEmailTemplateService : IBasicCRUDService { + Task> ReadByNameAsync(EmailTemplateType type); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Key.cs b/EnvelopeGenerator.Application/Key.cs index c1cd165d..768c2720 100644 --- a/EnvelopeGenerator.Application/Key.cs +++ b/EnvelopeGenerator.Application/Key.cs @@ -2,16 +2,17 @@ { public static class Key { - public static readonly string EnvelopeNotFound = "EnvelopeNotFound"; - public static readonly string EnvelopeReceiverNotFound = "EnvelopeReceiverNotFound"; - public static readonly string AccessCodeNull = "AccessCodeNull"; - public static readonly string WrongAccessCode = "WrongAccessCode"; - public static readonly string DataIntegrityIssue = "DataIntegrityIssue"; - public static readonly string SecurityBreachOrDataIntegrity = "SecurityBreachOrDataIntegrity"; - public static readonly string PossibleDataIntegrityIssue = "PossibleDataIntegrityIssue"; - public static readonly string SecurityBreach = "SecurityBreach"; - public static readonly string PossibleSecurityBreach = "PossibleSecurityBreach"; - public static readonly string WrongEnvelopeReceiverId = "WrongEnvelopeReceiverId"; - public static readonly string EnvelopeOrReceiverNonexists = "EnvelopeOrReceiverNonexists"; + public static readonly string InnerServiceError = nameof(InnerServiceError); + public static readonly string EnvelopeNotFound = nameof(EnvelopeNotFound); + public static readonly string EnvelopeReceiverNotFound = nameof(EnvelopeReceiverNotFound); + public static readonly string AccessCodeNull = nameof(AccessCodeNull); + public static readonly string WrongAccessCode = nameof(WrongAccessCode); + public static readonly string DataIntegrityIssue = nameof(DataIntegrityIssue); + public static readonly string SecurityBreachOrDataIntegrity = nameof(SecurityBreachOrDataIntegrity); + public static readonly string PossibleDataIntegrityIssue = nameof(PossibleDataIntegrityIssue); + public static readonly string SecurityBreach = nameof(SecurityBreach); + public static readonly string PossibleSecurityBreach = nameof(PossibleSecurityBreach); + public static readonly string WrongEnvelopeReceiverId = nameof(WrongEnvelopeReceiverId); + public static readonly string EnvelopeOrReceiverNonexists = nameof(EnvelopeOrReceiverNonexists); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EmailTemplateService.cs b/EnvelopeGenerator.Application/Services/EmailTemplateService.cs index 34f133f4..4ca4ee2e 100644 --- a/EnvelopeGenerator.Application/Services/EmailTemplateService.cs +++ b/EnvelopeGenerator.Application/Services/EmailTemplateService.cs @@ -6,6 +6,9 @@ using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using EnvelopeGenerator.Application.Resources; +using static EnvelopeGenerator.Common.Constants; +using DigitalData.Core.DTO; +using Microsoft.Extensions.Logging; namespace EnvelopeGenerator.Application.Services { @@ -15,5 +18,15 @@ namespace EnvelopeGenerator.Application.Services : base(repository, localizer, mapper) { } + + public async Task> ReadByNameAsync(EmailTemplateType type) + { + var temp = await _repository.ReadByNameAsync(type); + return temp is null + ? Result.Fail() + .Message(Key.InnerServiceError) + .Notice(LogLevel.Error, Flag.DataIntegrityIssue, $"EmailTemplateType '{type}' is not found in DB. Please, define required e-mail template.") + : Result.Success(_mapper.MapOrThrow(temp)); + } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Infrastructure/Contracts/IEmailTemplateRepository.cs b/EnvelopeGenerator.Infrastructure/Contracts/IEmailTemplateRepository.cs index b45c9eb3..91c7802d 100644 --- a/EnvelopeGenerator.Infrastructure/Contracts/IEmailTemplateRepository.cs +++ b/EnvelopeGenerator.Infrastructure/Contracts/IEmailTemplateRepository.cs @@ -1,9 +1,11 @@ using DigitalData.Core.Contracts.Infrastructure; using EnvelopeGenerator.Domain.Entities; +using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Infrastructure.Contracts { public interface IEmailTemplateRepository : ICRUDRepository { + Task ReadByNameAsync(EmailTemplateType type); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Infrastructure/Repositories/EmailTemplateRepository.cs b/EnvelopeGenerator.Infrastructure/Repositories/EmailTemplateRepository.cs index 9b8f29fb..1735311d 100644 --- a/EnvelopeGenerator.Infrastructure/Repositories/EmailTemplateRepository.cs +++ b/EnvelopeGenerator.Infrastructure/Repositories/EmailTemplateRepository.cs @@ -2,6 +2,8 @@ using DigitalData.UserManager.Infrastructure.Repositories; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.EntityFrameworkCore; +using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Infrastructure.Repositories { @@ -10,5 +12,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories public EmailTemplateRepository(EGDbContext dbContext) : base(dbContext) { } + + public async Task ReadByNameAsync(EmailTemplateType type) => await _dbSet.Where(t => t.Name == type.ToString()).FirstOrDefaultAsync(); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Web/Controllers/Test/TestEmailTemplateController.cs b/EnvelopeGenerator.Web/Controllers/Test/TestEmailTemplateController.cs index e216f6b4..50504002 100644 --- a/EnvelopeGenerator.Web/Controllers/Test/TestEmailTemplateController.cs +++ b/EnvelopeGenerator.Web/Controllers/Test/TestEmailTemplateController.cs @@ -1,7 +1,11 @@ -using EnvelopeGenerator.Application.Contracts; +using DigitalData.Core.DTO; +using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.AspNetCore.Mvc; +using System.Security.Cryptography; +using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Web.Controllers.Test { @@ -9,7 +13,23 @@ namespace EnvelopeGenerator.Web.Controllers.Test { public TestEmailTemplateController(ILogger logger, IEmailTemplateService service) : base(logger, service) { + } + [HttpGet] + public virtual async Task GetAll([FromQuery] string? tempType = null) + { + return tempType is null + ? await base.GetAll() + : await _service.ReadByNameAsync((EmailTemplateType)Enum.Parse(typeof(EmailTemplateType), tempType)).ThenAsync( + Success: Ok, + Fail: IActionResult (messages, notices) => + { + _logger.LogNotice(notices); + return NotFound(messages); + }); } + + [NonAction] + public override Task GetAll() => base.GetAll(); } } \ No newline at end of file From 86bdb233c22db91f6cd6bf10a11a61be82a4f663 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 09:54:49 +0200 Subject: [PATCH 03/30] =?UTF-8?q?EmailProfilerDispatcher=20hinzugef=C3=BCg?= =?UTF-8?q?t=20und=20EnvelopeMailService=20erstellt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IEmailOutService.cs | 11 --- .../Contracts/IEnvelopeMailService.cs | 8 ++ .../DTOs/EmailOutDto.cs | 25 ------ .../EnvelopeGenerator.Application.csproj | 9 ++ .../MappingProfiles/BasicDtoMappingProfile.cs | 2 - .../Services/EmailOutService.cs | 18 ---- .../Services/EnvelopeMailService.cs | 15 ++++ EnvelopeGenerator.Domain/Entities/EmailOut.cs | 89 ------------------- .../Contracts/IEmailOutRepository.cs | 9 -- .../Repositories/EmailOutRepository.cs | 14 --- .../EnvelopeGenerator.Web.csproj | 9 ++ EnvelopeGenerator.Web/Program.cs | 8 +- 12 files changed, 47 insertions(+), 170 deletions(-) delete mode 100644 EnvelopeGenerator.Application/Contracts/IEmailOutService.cs create mode 100644 EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs delete mode 100644 EnvelopeGenerator.Application/DTOs/EmailOutDto.cs delete mode 100644 EnvelopeGenerator.Application/Services/EmailOutService.cs create mode 100644 EnvelopeGenerator.Application/Services/EnvelopeMailService.cs delete mode 100644 EnvelopeGenerator.Domain/Entities/EmailOut.cs delete mode 100644 EnvelopeGenerator.Infrastructure/Contracts/IEmailOutRepository.cs delete mode 100644 EnvelopeGenerator.Infrastructure/Repositories/EmailOutRepository.cs diff --git a/EnvelopeGenerator.Application/Contracts/IEmailOutService.cs b/EnvelopeGenerator.Application/Contracts/IEmailOutService.cs deleted file mode 100644 index e1f934b5..00000000 --- a/EnvelopeGenerator.Application/Contracts/IEmailOutService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using DigitalData.Core.Contracts.Application; -using EnvelopeGenerator.Application.DTOs; -using EnvelopeGenerator.Domain.Entities; -using EnvelopeGenerator.Infrastructure.Contracts; - -namespace EnvelopeGenerator.Application.Contracts -{ - public interface IEmailOutService : IBasicCRUDService - { - } -} diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs new file mode 100644 index 00000000..56d65cb6 --- /dev/null +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs @@ -0,0 +1,8 @@ +using DigitalData.EmailProfilerDispatcher.Application.Contracts; + +namespace EnvelopeGenerator.Application.Contracts +{ + public interface IEnvelopeMailService : IEmailOutService + { + } +} diff --git a/EnvelopeGenerator.Application/DTOs/EmailOutDto.cs b/EnvelopeGenerator.Application/DTOs/EmailOutDto.cs deleted file mode 100644 index 6455acf7..00000000 --- a/EnvelopeGenerator.Application/DTOs/EmailOutDto.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace EnvelopeGenerator.Application.DTOs -{ - public record EmailOutDto( - int Guid, - int ReminderTypeId, - int SendingProfile, - int ReferenceId, - string? ReferenceString, - int? EntityId, - int WfId, - string? WfReference, - string EmailAdress, - string EmailSubj, - string EmailBody, - string? EmailAttmt1, - DateTime? EmailSent, - string? Comment, - string AddedWho, - DateTime? AddedWhen, - string? ChangedWho, - DateTime? ChangedWhen, - DateTime? ErrorTimestamp, - string? ErrorMsg - ); -} diff --git a/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj b/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj index 06b59406..e15e049b 100644 --- a/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj +++ b/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj @@ -28,6 +28,15 @@ ..\..\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Application.dll + + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll + + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Infrastructure.dll + ..\..\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.UserManager.Application.dll diff --git a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs b/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs index b271c472..3102576d 100644 --- a/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs +++ b/EnvelopeGenerator.Application/MappingProfiles/BasicDtoMappingProfile.cs @@ -23,7 +23,6 @@ namespace EnvelopeGenerator.Application.MappingProfiles CreateMap(); CreateMap(); CreateMap(); - CreateMap(); // DTO to Entity mappings CreateMap(); @@ -39,7 +38,6 @@ namespace EnvelopeGenerator.Application.MappingProfiles CreateMap(); CreateMap(); CreateMap(); - CreateMap(); } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EmailOutService.cs b/EnvelopeGenerator.Application/Services/EmailOutService.cs deleted file mode 100644 index 895f2f95..00000000 --- a/EnvelopeGenerator.Application/Services/EmailOutService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using AutoMapper; -using DigitalData.Core.Application; -using EnvelopeGenerator.Application.Contracts; -using EnvelopeGenerator.Application.DTOs; -using EnvelopeGenerator.Application.Resources; -using EnvelopeGenerator.Domain.Entities; -using EnvelopeGenerator.Infrastructure.Contracts; -using Microsoft.Extensions.Localization; - -namespace EnvelopeGenerator.Application.Services -{ - public class EmailOutService : BasicCRUDService, IEmailOutService - { - public EmailOutService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper) - { - } - } -} diff --git a/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs b/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs new file mode 100644 index 00000000..14841ffa --- /dev/null +++ b/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs @@ -0,0 +1,15 @@ +using AutoMapper; +using DigitalData.EmailProfilerDispatcher.Application.Services; +using DigitalData.EmailProfilerDispatcher.Infrastructure.Contracts; +using DigitalData.UserManager.Application; +using EnvelopeGenerator.Application.Contracts; +using Microsoft.Extensions.Localization; +namespace EnvelopeGenerator.Application.Services +{ + public class EnvelopeMailService : EmailOutService, IEnvelopeMailService + { + public EnvelopeMailService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper, IEmailTemplateService tempService) : base(repository, localizer, mapper) + { + } + } +} \ No newline at end of file diff --git a/EnvelopeGenerator.Domain/Entities/EmailOut.cs b/EnvelopeGenerator.Domain/Entities/EmailOut.cs deleted file mode 100644 index 68ac00b1..00000000 --- a/EnvelopeGenerator.Domain/Entities/EmailOut.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace EnvelopeGenerator.Domain.Entities -{ - [Table("TBEMLP_EMAIL_OUT", Schema = "dbo")] - public class EmailOut - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [Column("GUID")] - public int Id { get; set; } - - [Required] - [Column("REMINDER_TYPE_ID")] - public int ReminderTypeId { get; set; } = 1; // Default value - - [Required] - [Column("SENDING_PROFILE")] - public int SendingProfile { get; set; } - - [Required] - [Column("REFERENCE_ID")] - public int ReferenceId { get; set; } - - [StringLength(200)] - [Column("REFERENCE_STRING")] - public string ReferenceString { get; set; } - - [Column("ENTITY_ID")] - public int? EntityId { get; set; } - - [Required] - [Column("WF_ID")] - public int WfId { get; set; } - - [StringLength(200)] - [Column("WF_REFERENCE")] - public string WfReference { get; set; } - - [Required] - [StringLength(1000)] - [Column("EMAIL_ADRESS")] - public string EmailAdress { get; set; } - - [Required] - [StringLength(500)] - [Column("EMAIL_SUBJ")] - public string EmailSubj { get; set; } - - [Required] - [Column("EMAIL_BODY")] - public string EmailBody { get; set; } - - [StringLength(512)] - [Column("EMAIL_ATTMT1")] - public string EmailAttmt1 { get; set; } - - [Column("EMAIL_SENT")] - public DateTime? EmailSent { get; set; } - - [StringLength(500)] - [Column("COMMENT")] - public string Comment { get; set; } - - [Required] - [StringLength(50)] - [Column("ADDED_WHO")] - public string AddedWho { get; set; } = "DEFAULT"; // Default value - - [Column("ADDED_WHEN")] - public DateTime? AddedWhen { get; set; } = DateTime.Now; // Default value - - [StringLength(50)] - [Column("CHANGED_WHO")] - public string ChangedWho { get; set; } - - [Column("CHANGED_WHEN")] - public DateTime? ChangedWhen { get; set; } - - [Column("ERROR_TIMESTAMP")] - public DateTime? ErrorTimestamp { get; set; } - - [StringLength(900)] - [Column("ERROR_MSG")] - public string ErrorMsg { get; set; } - } -} \ No newline at end of file diff --git a/EnvelopeGenerator.Infrastructure/Contracts/IEmailOutRepository.cs b/EnvelopeGenerator.Infrastructure/Contracts/IEmailOutRepository.cs deleted file mode 100644 index 1b7425f5..00000000 --- a/EnvelopeGenerator.Infrastructure/Contracts/IEmailOutRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using DigitalData.Core.Contracts.Infrastructure; -using EnvelopeGenerator.Domain.Entities; - -namespace EnvelopeGenerator.Infrastructure.Contracts -{ - public interface IEmailOutRepository : ICRUDRepository - { - } -} diff --git a/EnvelopeGenerator.Infrastructure/Repositories/EmailOutRepository.cs b/EnvelopeGenerator.Infrastructure/Repositories/EmailOutRepository.cs deleted file mode 100644 index 397e8b14..00000000 --- a/EnvelopeGenerator.Infrastructure/Repositories/EmailOutRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DigitalData.Core.Infrastructure; -using DigitalData.UserManager.Infrastructure.Repositories; -using EnvelopeGenerator.Domain.Entities; -using EnvelopeGenerator.Infrastructure.Contracts; - -namespace EnvelopeGenerator.Infrastructure.Repositories -{ - public class EmailOutRepository : CRUDRepository, IEmailOutRepository - { - public EmailOutRepository(EGDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj index 6f4e9152..322ad5eb 100644 --- a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj +++ b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj @@ -62,6 +62,15 @@ ..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Application.dll + + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll + + + ..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Infrastructure.dll + ..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 856189a8..e67d56a1 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -17,6 +17,8 @@ using DigitalData.Core.DTO; using System.Text.Encodings.Web; using Ganss.Xss; using Microsoft.Extensions.Options; +using DigitalData.EmailProfilerDispatcher.Application; +using DigitalData.UserManager.Application; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized!"); @@ -89,7 +91,6 @@ try builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -103,7 +104,6 @@ try builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); //Auto mapping profiles builder.Services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly); @@ -170,6 +170,10 @@ try builder.Services.Configure(builder.Configuration.GetSection("Cultures")); builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); + // Register mail services + builder.Services.AddScoped(); + builder.Services.AddDispatcher(); + var app = builder.Build(); // Configure the HTTP request pipeline. From 0ef9d3c49effdc762ef4a0e522bc22ecb25adb36 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 09:56:02 +0200 Subject: [PATCH 04/30] =?UTF-8?q?Unn=C3=B6tige=20.git-Dateien=20unter=20.w?= =?UTF-8?q?eb=20wurden=20entfernt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/.gitattributes | 63 ----- EnvelopeGenerator.Web/.gitignore | 363 --------------------------- 2 files changed, 426 deletions(-) delete mode 100644 EnvelopeGenerator.Web/.gitattributes delete mode 100644 EnvelopeGenerator.Web/.gitignore diff --git a/EnvelopeGenerator.Web/.gitattributes b/EnvelopeGenerator.Web/.gitattributes deleted file mode 100644 index 1ff0c423..00000000 --- a/EnvelopeGenerator.Web/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/EnvelopeGenerator.Web/.gitignore b/EnvelopeGenerator.Web/.gitignore deleted file mode 100644 index 9491a2fd..00000000 --- a/EnvelopeGenerator.Web/.gitignore +++ /dev/null @@ -1,363 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Oo]ut/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file From 1664b5739ef5c49ad0d318bfb5a114e37a63dcc4 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 12:03:48 +0200 Subject: [PATCH 05/30] Program.cs und appsettings.json bearbeitet. Abschnitt Config aus appsettings.json entfernt. --- EnvelopeGenerator.Application/Key.cs | 1 + .../Controllers/Test/TestViewController.cs | 2 +- EnvelopeGenerator.Web/Program.cs | 20 ++++++++----- .../Services/DatabaseService.cs | 5 ++-- EnvelopeGenerator.Web/appsettings.json | 29 +++++++++---------- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/EnvelopeGenerator.Application/Key.cs b/EnvelopeGenerator.Application/Key.cs index 768c2720..4509d0ea 100644 --- a/EnvelopeGenerator.Application/Key.cs +++ b/EnvelopeGenerator.Application/Key.cs @@ -14,5 +14,6 @@ public static readonly string PossibleSecurityBreach = nameof(PossibleSecurityBreach); public static readonly string WrongEnvelopeReceiverId = nameof(WrongEnvelopeReceiverId); public static readonly string EnvelopeOrReceiverNonexists = nameof(EnvelopeOrReceiverNonexists); + public static readonly string Default = nameof(Default); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Web/Controllers/Test/TestViewController.cs b/EnvelopeGenerator.Web/Controllers/Test/TestViewController.cs index a52db294..09e06299 100644 --- a/EnvelopeGenerator.Web/Controllers/Test/TestViewController.cs +++ b/EnvelopeGenerator.Web/Controllers/Test/TestViewController.cs @@ -27,7 +27,7 @@ namespace EnvelopeGenerator.Web.Controllers.Test { try { - var passwordFromConfig = _config["Config:AdminPassword"]; + var passwordFromConfig = _config["AdminPassword"]; if (passwordFromConfig == null) { diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index e67d56a1..d21238ac 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -18,7 +18,6 @@ using System.Text.Encodings.Web; using Ganss.Xss; using Microsoft.Extensions.Options; using DigitalData.EmailProfilerDispatcher.Application; -using DigitalData.UserManager.Application; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized!"); @@ -72,7 +71,7 @@ try } //AddEF Core dbcontext - var connStr = config["Config:ConnectionString"]; + var connStr = config.GetConnectionString(Key.Default) ?? throw new InvalidOperationException("There is no default connection string in appsettings.json."); builder.Services.AddDbContext(options => options.UseSqlServer(connStr)); //Inject CRUD Service and repositoriesad @@ -151,7 +150,7 @@ try }; }); - builder.Services.AddSingleton(_ => config.GetSection("ContactLink").Get() ?? new ContactLink()); + builder.Services.AddSingleton(config.GetSection("ContactLink").Get() ?? new()); builder.Services.AddCookieConsentSettings(); @@ -167,7 +166,7 @@ try }); // Register the FlagIconCssClass instance as a singleton - builder.Services.Configure(builder.Configuration.GetSection("Cultures")); + builder.Services.Configure(config.GetSection("Cultures")); builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); // Register mail services @@ -185,11 +184,18 @@ try } //Content-Security-Policy - if (config.GetValue("TestCSP") || !app.Environment.IsDevelopment()) + if (config.GetValue("UseCSPInDev") || !app.Environment.IsDevelopment()) { var csp_list = config.GetSection("Content-Security-Policy").Get(); - if (csp_list is not null) - app.UseCSPMiddleware($"{string.Join("; ", csp_list)};"); + if (csp_list is null) + logger.Warn("There is no Content-Security-Policy"); + else + { + var csp = string.Join("; ", csp_list?.Where(st => st is not null) ?? Array.Empty()); + logger.Info($"Content-Security-Policy {csp}"); + if (csp_list is not null) + app.UseCSPMiddleware(csp); + } } if (config.GetValue("EnableSwagger")) diff --git a/EnvelopeGenerator.Web/Services/DatabaseService.cs b/EnvelopeGenerator.Web/Services/DatabaseService.cs index da97a486..2dd78df7 100644 --- a/EnvelopeGenerator.Web/Services/DatabaseService.cs +++ b/EnvelopeGenerator.Web/Services/DatabaseService.cs @@ -1,5 +1,6 @@ using DigitalData.Modules.Database; using DigitalData.Modules.Logging; +using EnvelopeGenerator.Application; using EnvelopeGenerator.Common; namespace EnvelopeGenerator.Web.Services @@ -52,11 +53,11 @@ namespace EnvelopeGenerator.Web.Services public DatabaseService(ILogger logger, IConfiguration config) { - LogConfig logConfig = new LogConfig(LogConfig.PathType.CustomPath, config["Config:LogPath"], null, "Digital Data", "ECM.EnvelopeGenerator.Web"); + LogConfig logConfig = new LogConfig(LogConfig.PathType.CustomPath, config["NLog:variables:logDirectory"], null, "Digital Data", "ECM.EnvelopeGenerator.Web"); _logger = logger; _logger.LogInformation("Establishing MSSQL Database connection.."); - MSSQL = new MSSQLServer(logConfig, config["Config:ConnectionString"]); + MSSQL = new MSSQLServer(logConfig, config.GetConnectionString(Key.Default)); if (MSSQL.DBInitialized == true) { diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 90e35de5..4937986a 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -10,20 +10,16 @@ "Microsoft.AspNetCore.Hosting.Diagnostics": "Warning" } }, - "Config": { - "ConnectionString": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;", - "LogPath": "E:\\EnvelopeGenerator\\Logs", - "LogDebug": true, - "LogJson": true, - "AdminPassword": "dd" + "ConnectionStrings": { + "Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;" }, + "AdminPassword": "dd", "PSPDFKitLicenseKey": null, - /* The first format parameter {0} will be replaced by the nonce value. */ - "TestCSP": false, - "Content-Security-Policy": [ + "UseCSPInDev": false, + "Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value. "default-src 'self'", - "script-src 'self' 'nonce-{0}' 'unsafe-inline' 'unsafe-eval' blob: data:", - "style-src 'self' 'unsafe-inline'", + "script-src 'self' 'nonce-{0}' blob: data:", + "style-src 'self'", "img-src 'self' data: https: blob:", "font-src 'self'", "connect-src 'self' http://localhost:* https://localhost:* ws://localhost:* wss://localhost:* blob:", @@ -32,24 +28,27 @@ "object-src 'self'", "worker-src 'self' blob: data:" ], - "AdminPassword": "dd", "AllowedOrigins": [ "https://localhost:7202", "https://digitale.unterschrift.wisag.de/" ], "NLog": { "throwConfigExceptions": true, + "variables": { + "logDirectory": "E:\\EnvelopeGenerator\\Logs", + "logFileNamePrefix": "${shortdate}-ECM.EnvelopeGenerator.Web" + }, "targets": { "infoLogs": { "type": "File", - "fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Info.log", + "fileName": "${logDirectory}\\${logFileNamePrefix}-Info.log", "maxArchiveDays": 30 }, "errorLogs": { "type": "File", - "fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Error.log", + "fileName": "${logDirectory}\\${logFileNamePrefix}-Error.log", "maxArchiveDays": 30 }, "criticalLogs": { "type": "File", - "fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Critical.log", + "fileName": "${logDirectory}\\${logFileNamePrefix}-Critical.log", "maxArchiveDays": 30 } }, From ed25482cee80d5d436835e4c226edf771281d1c9 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 13:11:02 +0200 Subject: [PATCH 06/30] =?UTF-8?q?Der=20DiP-Modus=20(Development=20in=20pro?= =?UTF-8?q?duction)=20wurde=20f=C3=BCr=20Swagger-=20und=20Test-Controller?= =?UTF-8?q?=20integriert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/Program.cs | 9 ++++++--- EnvelopeGenerator.Web/appsettings.json | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index d21238ac..0f8f8cf6 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -18,6 +18,8 @@ using System.Text.Encodings.Web; using Ganss.Xss; using Microsoft.Extensions.Options; using DigitalData.EmailProfilerDispatcher.Application; +using EnvelopeGenerator.Application; +using EnvelopeGenerator.Application.Resources; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized!"); @@ -56,15 +58,16 @@ try { //remove option for Test*Controller options.Conventions.Add(new RemoveIfControllerConvention() + .AndIf(_ => !builder.IsDevOrDiP()) .AndIf(c => c.ControllerName.StartsWith("Test")) - .AndIf(c => !config.GetValue("EnableTestControllers"))); + .AndIf(_ => !config.GetValue("EnableTestControllers"))); }).AddJsonOptions(q => { // Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver q.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles; }); - if (config.GetValue("EnableSwagger")) + if (config.GetValue("EnableSwagger") && builder.IsDevOrDiP()) { builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); @@ -198,7 +201,7 @@ try } } - if (config.GetValue("EnableSwagger")) + if (config.GetValue("EnableSwagger") && builder.IsDevOrDiP()) { app.UseSwagger(); app.UseSwaggerUI(); diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 4937986a..e4b9a64d 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -1,4 +1,5 @@ { + "DipMode": false, //Please be careful when enabling Development in Production (DiP) mode. It allows Swagger and test controllers to be enabled in a production environment. "EnableSwagger": true, "EnableTestControllers": true, "DetailedErrors": true, From a6635f4a20ae74fc9ee7edd9594d918640c7fd15 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 13:13:37 +0200 Subject: [PATCH 07/30] =?UTF-8?q?Falscher=20Schl=C3=BCsselname=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index e4b9a64d..96200de8 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -1,5 +1,5 @@ { - "DipMode": false, //Please be careful when enabling Development in Production (DiP) mode. It allows Swagger and test controllers to be enabled in a production environment. + "DiPMode": false, //Please be careful when enabling Development in Production (DiP) mode. It allows Swagger and test controllers to be enabled in a production environment. "EnableSwagger": true, "EnableTestControllers": true, "DetailedErrors": true, From 1f4cf54406cca83a6651947ed81c613862a7fb17 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 15:48:37 +0200 Subject: [PATCH 08/30] =?UTF-8?q?Fehler=20behoben:=20Signaturfilter=20in?= =?UTF-8?q?=20Envelope.Documents.Elements=20in=20EnvelopeReceiverRepositor?= =?UTF-8?q?y=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/EnvlopeReceiverRepository.cs | 2 +- EnvelopeGenerator.Web/Controllers/HomeController.cs | 4 +--- EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml | 6 ++---- EnvelopeGenerator.Web/appsettings.json | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/EnvelopeGenerator.Infrastructure/Repositories/EnvlopeReceiverRepository.cs b/EnvelopeGenerator.Infrastructure/Repositories/EnvlopeReceiverRepository.cs index 2e01933a..21c07088 100644 --- a/EnvelopeGenerator.Infrastructure/Repositories/EnvlopeReceiverRepository.cs +++ b/EnvelopeGenerator.Infrastructure/Repositories/EnvlopeReceiverRepository.cs @@ -25,7 +25,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories if (withEnvelope) query = query - .Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements) + .Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements!.Where(e => signature == null || e.Receiver!.Signature == signature)) .Include(er => er.Envelope).ThenInclude(e => e!.History) .Include(er => er.Envelope).ThenInclude(e => e!.User); diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index 27700489..d9b6ac9e 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -77,7 +77,7 @@ namespace EnvelopeGenerator.Web.Controllers } [HttpGet("EnvelopeKey/{envelopeReceiverId}/Locked")] - public async Task EnvelopeLocked([FromRoute] string envelopeReceiverId, [FromQuery] string? culture) + public async Task EnvelopeLocked([FromRoute] string envelopeReceiverId, [FromQuery] string? culture = null) { try { @@ -90,9 +90,7 @@ namespace EnvelopeGenerator.Web.Controllers return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}"); } else if (UserLanguage is not null && culture is not null) - { return Redirect($"Locked"); - } ViewData["UserLanguage"] = UserLanguage ?? culture; diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index 8962c07e..b4202fb2 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -45,6 +45,7 @@ + }
\ No newline at end of file diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 96200de8..04f2c700 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -15,7 +15,7 @@ "Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;" }, "AdminPassword": "dd", - "PSPDFKitLicenseKey": null, + "PSPDFKitLicenseKey_SignFlow": "y8VgCpBgUfNlpKJZC-GwjpPs-S-KFBHv4RywfHbqpBAbO0XxRuWDaMGZtIaMrXBDlndlJLk---Ve93xjI_ZR4sbFymf4Ot97yTYUMeDdL2LYXhspkEnSAtkXf9zqepNL1v_0DMibjpqXFQMkVB1y3D5xdnOg-iJuCCZEMhZ780qg04_H_nmx63uSgxjN0GJxC8YvsbnRcUZ2l_idImMvWL0HMqB5B7oEpNenasA0RK0uapFRTa7NIQok0phpTHZYKB4qvj7od2yxlytGB7qBl4-lwT70DSQ9mrLkCWbuzZ9cV9D8fDzdFXr6WoZdOYpkrUadRbsy2bhPq_ukxszDWN4JGhebo0XKUK_YfgvSlS7lFOxHNblHeC9B7gZ8T-VuQ_z1QA2JYRf1dmhSuclnW00diShIg-N0I79PWGsQE4j40XtVpyWcN9uT9hMuiRpL0LzHV4YgsgBrgKgs_moqL7f0L4-MwaS25Dx4Wcz4ttKaerLavwMM4CJHI3DNqTC5UUEG6EViFxBQtrmuAS7kiw2nWjvXO7kUA24NARtsRCphjWE4l6wSMdh7kpqhfbV7_hdb5xXYGALNPkv8En6zPpFIew8DDcOH9dgxfKMI34LLhkEWqovZW_7fXNJTEIHVpR0DSPbZrmyEwkECnbDcNzjyFk2M1fzstJj_dSotyZvS57XJK2DgojbRgXL9pncs", "UseCSPInDev": false, "Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value. "default-src 'self'", From 0c6fd2efe33cecec13569e44844311e8a67dab8e Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 15:50:32 +0200 Subject: [PATCH 09/30] =?UTF-8?q?Refaktorieren=20Sie=20den=20App-Konstrukt?= =?UTF-8?q?or,=20um=20container=20standardm=C3=A4=C3=9Fig=20auf=20einen=20?= =?UTF-8?q?Wert=20basierend=20auf=20dem=20Klassennamen=20zu=20setzen,=20fa?= =?UTF-8?q?lls=20nicht=20angegeben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/wwwroot/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index 37a71451..fda1d49e 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -10,8 +10,8 @@ const ActionType = { } class App { - constructor(container, envelopeKey, envelopeReceiver, documentBytes, licenseKey) { - this.container = container + constructor(envelopeKey, envelopeReceiver, documentBytes, licenseKey, container) { + this.container = container ?? `#${this.constructor.name.toLowerCase()}`; this.envelopeKey = envelopeKey this.UI = new UI() From 824bf6fb829425468a2b103f17529400b4fecb84 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 16:16:13 +0200 Subject: [PATCH 10/30] =?UTF-8?q?B64ToBuff-Funktion=20zum=20Konvertieren?= =?UTF-8?q?=20von=20Base64-String=20in=20ArrayBuffer=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml | 11 +---------- EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml | 1 + EnvelopeGenerator.Web/wwwroot/js/util.js | 1 + 3 files changed, 3 insertions(+), 10 deletions(-) create mode 100644 EnvelopeGenerator.Web/wwwroot/js/util.js diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index b4202fb2..ec1badeb 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -71,16 +71,7 @@ var envelopeKey = ViewData["EnvelopeKey"] as string; }
\ No newline at end of file diff --git a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml index 7baa0247..4b93faf7 100644 --- a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml +++ b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml @@ -23,6 +23,7 @@ + @await RenderSectionAsync("Scripts", required: false)
diff --git a/EnvelopeGenerator.Web/wwwroot/js/util.js b/EnvelopeGenerator.Web/wwwroot/js/util.js new file mode 100644 index 00000000..bba9fce3 --- /dev/null +++ b/EnvelopeGenerator.Web/wwwroot/js/util.js @@ -0,0 +1 @@ +const B64ToBuff = (base64String) => new Uint8Array(Array.from(atob(base64String), char => char.charCodeAt(0))).buffer; \ No newline at end of file From 8d6d483c5da71a3f30826df2ed1c4a7300a56201 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 16:34:14 +0200 Subject: [PATCH 11/30] =?UTF-8?q?Unn=C3=B6tige=20console.log=20und=20conso?= =?UTF-8?q?le.errors=20entfernt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml | 1 - EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml | 1 - EnvelopeGenerator.Web/wwwroot/js/annotation.js | 2 -- EnvelopeGenerator.Web/wwwroot/js/app.js | 8 +------- EnvelopeGenerator.Web/wwwroot/js/ui.js | 2 -- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index ec1badeb..13e75b1a 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -45,7 +45,6 @@ - - @await RenderSectionAsync("Scripts", required: false)
diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 9cd2f0d5..cde6cacf 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -3,8 +3,6 @@ const annotations = [] document.elements.forEach((element) => { - console.debug('Creating annotation for element', element.id) - const [annotation, formField] = this.createAnnotationFromElement(element) annotations.push(annotation) annotations.push(formField) diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index fda1d49e..01e6e6f5 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -38,7 +38,6 @@ class App { const documentResponse = this.documentBytes if (documentResponse.fatal || documentResponse.error) { - console.error(documentResponse.error) return Swal.fire({ title: 'Fehler', text: 'Dokument konnte nicht geladen werden!', @@ -66,7 +65,6 @@ class App { ) // Load annotations into PSPDFKit - console.debug('Loading annotations..') try { this.signatureCount = this.currentDocument.elements.length @@ -85,12 +83,11 @@ class App { }) } } catch (e) { - console.error(e) } } handleAnnotationsLoad(loadedAnnotations) { - console.debug('annotations loaded', loadedAnnotations.toJS()) + loadedAnnotations.toJS() } handleAnnotationsChange() { } @@ -184,7 +181,6 @@ class App { try { await this.Instance.save() } catch (e) { - console.error(e) Swal.fire({ title: 'Fehler', text: 'Umschlag konnte nicht signiert werden!', @@ -196,7 +192,6 @@ class App { // Export annotation data and save to database try { const json = await this.Instance.exportInstantJSON() - console.log(json) const postEnvelopeResult = await this.Network.postEnvelope( this.envelopeKey, this.currentDocument.id, @@ -223,7 +218,6 @@ class App { return true } catch (e) { - console.error(e) return false } } diff --git a/EnvelopeGenerator.Web/wwwroot/js/ui.js b/EnvelopeGenerator.Web/wwwroot/js/ui.js index d284fe2c..631eaacb 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/ui.js +++ b/EnvelopeGenerator.Web/wwwroot/js/ui.js @@ -47,8 +47,6 @@ configurePSPDFKit(instance, handler) { const toolbarItems = this.getToolbarItems(instance, handler) instance.setToolbarItems(toolbarItems) - - console.debug('PSPDFKit configured!') } annotationRenderer(data) { From 90ac81c576fea60ebebcef28a8b1261969bc3ad1 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 16:53:55 +0200 Subject: [PATCH 12/30] Merged scripts --- EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index 13e75b1a..7adb23fc 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -57,7 +57,6 @@ } }); } - @if (ViewData["DocumentBytes"] is byte[] documentBytes) { var settings = new Newtonsoft.Json.JsonSerializerSettings @@ -69,8 +68,7 @@ var envelopeKey = ViewData["EnvelopeKey"] as string; - + @:document.addEventListener("DOMContentLoaded", async () => await new App("@envelopeKey.TrySanitize(_sanitizer)", @Html.Raw(envelopeReceiverJson.TrySanitize(_sanitizer)), B64ToBuff("@Html.Raw(documentBase64String.TrySanitize(_sanitizer))"), "@ViewData["PSPDFKitLicenseKey"]").init()) } +
\ No newline at end of file From 60afdc23dad0b91a09c910ead677840a2047291c Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 23 May 2024 10:42:55 +0200 Subject: [PATCH 13/30] =?UTF-8?q?Behebt=20das=20Scrollproblem=20des=20ifra?= =?UTF-8?q?mes=20durch=20Festlegen=20der=20H=C3=B6he=20mit=20Viewport-Einh?= =?UTF-8?q?eiten,=20um=20eine=20ordnungsgem=C3=A4=C3=9Fe=20interne=20Scrol?= =?UTF-8?q?l-Verarbeitung=20zu=20gew=C3=A4hrleisten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/ShowEnvelope.cshtml | 50 +++++++-------- EnvelopeGenerator.Web/wwwroot/css/site.css | 61 +++++++++---------- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index 7adb23fc..6f7b7daa 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -16,34 +16,37 @@ var stPageIndexes = string.Join(pages.Count() > 1 ? ", " : "", pages.Take(pages.Count() - 1)) + (pages.Count() > 1 ? " und " : "") + pages.LastOrDefault(); } - + + @* *@ +
-
\ No newline at end of file + \ No newline at end of file diff --git a/EnvelopeGenerator.Web/wwwroot/css/site.css b/EnvelopeGenerator.Web/wwwroot/css/site.css index 1fb08ec5..3fc2c305 100644 --- a/EnvelopeGenerator.Web/wwwroot/css/site.css +++ b/EnvelopeGenerator.Web/wwwroot/css/site.css @@ -4,14 +4,13 @@ */ /* Toolbar Buttons */ - #app { background: gray; width: 100vw; - height: 100vh; - margin: 0 auto; + height: 1vh; } + .button-finish { transition: background-color linear 300ms; background-color: #059669; /* emerald-600 */ @@ -19,10 +18,10 @@ border-left: none; } - .button-finish:hover, .button-finish:focus, .button-finish:active { - background-color: #10b981; /* emerald-500 */ - color: white; - } +.button-finish:hover, .button-finish:focus, .button-finish:active { + background-color: #10b981; /* emerald-500 */ + color: white; +} .button-reject { transition: background-color linear 300ms; @@ -31,10 +30,10 @@ border-left: none; } - .button-reject:hover, .button-reject:focus, .button-reject:active { - background-color: #f59e0b; /* amber-500 */ - color: white; - } +.button-reject:hover, .button-reject:focus, .button-reject:active { + background-color: #f59e0b; /* amber-500 */ + color: white; +} .button-reset { transition: background-color linear 300ms; @@ -43,10 +42,10 @@ border-left: none; } - .button-reset:hover, .button-reset:focus, .button-reset:active { - background-color: #3b82f6; /* blue-500 */ - color: white; - } +.button-reset:hover, .button-reset:focus, .button-reset:active { + background-color: #3b82f6; /* blue-500 */ + color: white; +} body { background-color: #bbb; @@ -72,20 +71,20 @@ body { margin-bottom: 2rem; } - .page header .icon.admin { - background-color: #331904; - color: #fecba1; - } +.page header .icon.admin { + background-color: #331904; + color: #fecba1; +} - .page header .icon.locked { - background-color: #ffc107; - color: #000; - } +.page header .icon.locked { + background-color: #ffc107; + color: #000; +} - .page header .icon.signed { - background-color: #146c43; - color: #fff; - } +.page header .icon.signed { + background-color: #146c43; + color: #fff; +} .page .form { max-width: 30rem; @@ -95,10 +94,10 @@ body { gap: 1rem; } - #form-access-code > .input, - #form-admin-password > .input { - flex-grow: 1; - } +#form-access-code > .input, +#form-admin-password > .input { + flex-grow: 1; +} #page-admin header .icon { background-color: #331904; From 2014f6149db02d71973d43670accd05cddab0159 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 23 May 2024 13:52:37 +0200 Subject: [PATCH 14/30] =?UTF-8?q?Interne=20Schaltfl=C3=A4chen=20wurden=20e?= =?UTF-8?q?ntfernt.=20Stattdessen=20wurden=20externe=20Sende-=20und=20Aktu?= =?UTF-8?q?alisierungsschaltfl=C3=A4chen=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/ShowEnvelope.cshtml | 17 ++++++++++++++++- .../Views/Shared/_Layout.cshtml | 1 - EnvelopeGenerator.Web/wwwroot/css/site.css | 19 ++++++++++++++++++- EnvelopeGenerator.Web/wwwroot/js/app.js | 6 ++++-- EnvelopeGenerator.Web/wwwroot/js/ui.js | 1 + 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index 6f7b7daa..479cf3cd 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -45,7 +45,22 @@ - @* *@ + +
+ + +
diff --git a/EnvelopeGenerator.Web/wwwroot/css/site.css b/EnvelopeGenerator.Web/wwwroot/css/site.css index 3fc2c305..87a4b309 100644 --- a/EnvelopeGenerator.Web/wwwroot/css/site.css +++ b/EnvelopeGenerator.Web/wwwroot/css/site.css @@ -7,9 +7,26 @@ #app { background: gray; width: 100vw; - height: 1vh; + height: 80vh; } +.btn-group { + margin-right: 10vw; + margin-bottom: 10vh; +} +.btn_refresh, .btn_complete { + height:4vh +} +.btn_refresh { +} +.btn_complete{ +} +.btn_complete .icon { + width: 2vh; +} +.btn_complete span { + vertical-align: middle; +} .button-finish { transition: background-color linear 300ms; diff --git a/EnvelopeGenerator.Web/wwwroot/js/app.js b/EnvelopeGenerator.Web/wwwroot/js/app.js index 01e6e6f5..ed83d568 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/app.js +++ b/EnvelopeGenerator.Web/wwwroot/js/app.js @@ -65,7 +65,6 @@ class App { ) // Load annotations into PSPDFKit - try { this.signatureCount = this.currentDocument.elements.length const annotations = this.Annotation.createAnnotations( @@ -84,6 +83,10 @@ class App { } } catch (e) { } + + //add click events of external buttons + [...document.getElementsByClassName('btn_refresh')].forEach(btn => btn.addEventListener('click', _ => this.handleClick('RESET'))); + [...document.getElementsByClassName('btn_complete')].forEach(btn => btn.addEventListener('click', _ => this.handleClick('FINISH'))); } handleAnnotationsLoad(loadedAnnotations) { @@ -165,7 +168,6 @@ class App { } async handleFinish(event) { - const validationResult = await this.validateAnnotations(this.signatureCount) if (validationResult === false) { Swal.fire({ diff --git a/EnvelopeGenerator.Web/wwwroot/js/ui.js b/EnvelopeGenerator.Web/wwwroot/js/ui.js index 631eaacb..7ebd9047 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/ui.js +++ b/EnvelopeGenerator.Web/wwwroot/js/ui.js @@ -68,6 +68,7 @@ } getCustomItems = function (callback) { + return [] return [ { type: 'custom', From 7863e861c737009cc7f8e1f61c56c6aea4358e7c Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 23 May 2024 16:37:13 +0200 Subject: [PATCH 15/30] CSP zur Verwendung in der Produktion wurde protokolliert. --- EnvelopeGenerator.Web/appsettings.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 04f2c700..bbe280a0 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -16,11 +16,11 @@ }, "AdminPassword": "dd", "PSPDFKitLicenseKey_SignFlow": "y8VgCpBgUfNlpKJZC-GwjpPs-S-KFBHv4RywfHbqpBAbO0XxRuWDaMGZtIaMrXBDlndlJLk---Ve93xjI_ZR4sbFymf4Ot97yTYUMeDdL2LYXhspkEnSAtkXf9zqepNL1v_0DMibjpqXFQMkVB1y3D5xdnOg-iJuCCZEMhZ780qg04_H_nmx63uSgxjN0GJxC8YvsbnRcUZ2l_idImMvWL0HMqB5B7oEpNenasA0RK0uapFRTa7NIQok0phpTHZYKB4qvj7od2yxlytGB7qBl4-lwT70DSQ9mrLkCWbuzZ9cV9D8fDzdFXr6WoZdOYpkrUadRbsy2bhPq_ukxszDWN4JGhebo0XKUK_YfgvSlS7lFOxHNblHeC9B7gZ8T-VuQ_z1QA2JYRf1dmhSuclnW00diShIg-N0I79PWGsQE4j40XtVpyWcN9uT9hMuiRpL0LzHV4YgsgBrgKgs_moqL7f0L4-MwaS25Dx4Wcz4ttKaerLavwMM4CJHI3DNqTC5UUEG6EViFxBQtrmuAS7kiw2nWjvXO7kUA24NARtsRCphjWE4l6wSMdh7kpqhfbV7_hdb5xXYGALNPkv8En6zPpFIew8DDcOH9dgxfKMI34LLhkEWqovZW_7fXNJTEIHVpR0DSPbZrmyEwkECnbDcNzjyFk2M1fzstJj_dSotyZvS57XJK2DgojbRgXL9pncs", - "UseCSPInDev": false, + "UseCSPInDev": true, "Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value. "default-src 'self'", - "script-src 'self' 'nonce-{0}' blob: data:", - "style-src 'self'", + "script-src 'self' 'nonce-{0}' 'unsafe-inline' 'unsafe-eval' blob: data:", + "style-src 'self' 'unsafe-inline'", "img-src 'self' data: https: blob:", "font-src 'self'", "connect-src 'self' http://localhost:* https://localhost:* ws://localhost:* wss://localhost:* blob:", From b60ae62779f8b207914c6fde924ca31ca9c2849b Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 24 May 2024 11:39:12 +0200 Subject: [PATCH 16/30] Aktualisierte EnvelopeClaims --- .../Resources/Resource.de-DE.resx | 6 ++++++ .../Resources/Resource.en-US.resx | 6 ++++++ EnvelopeGenerator.Web/Controllers/HomeController.cs | 12 ++++++++++-- EnvelopeGenerator.Web/EnvelopeClaimTypes.cs | 13 +++++++++++++ EnvelopeGenerator.Web/Program.cs | 3 ++- EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml | 1 + EnvelopeGenerator.Web/wwwroot/js/api.js | 7 +++++++ EnvelopeGenerator.Web/wwwroot/js/ui.js | 2 +- 8 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 EnvelopeGenerator.Web/EnvelopeClaimTypes.cs create mode 100644 EnvelopeGenerator.Web/wwwroot/js/api.js diff --git a/EnvelopeGenerator.Application/Resources/Resource.de-DE.resx b/EnvelopeGenerator.Application/Resources/Resource.de-DE.resx index 6b26b6cd..ece65ad1 100644 --- a/EnvelopeGenerator.Application/Resources/Resource.de-DE.resx +++ b/EnvelopeGenerator.Application/Resources/Resource.de-DE.resx @@ -141,4 +141,10 @@ Dokument erfordert einen Zugriffscode + + Ein unerwarteter Fehler ist aufgetreten. + + + Ungültiger Zugangscode. + \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Resources/Resource.en-US.resx b/EnvelopeGenerator.Application/Resources/Resource.en-US.resx index 226ae4d3..87e3bae3 100644 --- a/EnvelopeGenerator.Application/Resources/Resource.en-US.resx +++ b/EnvelopeGenerator.Application/Resources/Resource.en-US.resx @@ -141,4 +141,10 @@ Document requires an access code + + An unexpected error has occurred. + + + Invalid access code. + \ No newline at end of file diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index d9b6ac9e..3124b938 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -154,10 +154,18 @@ namespace EnvelopeGenerator.Web.Controllers return this.ViewDocumentNotFound(); } - var claims = new List { new(ClaimTypes.NameIdentifier, uuid), new(ClaimTypes.Hash, signature) }; + var claims = new List { + new(ClaimTypes.NameIdentifier, uuid), + new(ClaimTypes.Hash, signature), + new(ClaimTypes.Name, er.Name ?? string.Empty), + new(ClaimTypes.Email, er.Receiver.EmailAddress), + new(EnvelopeClaimTypes.Title, er.Envelope.Title) + }; var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); - var authProperties = new AuthenticationProperties { }; + var authProperties = new AuthenticationProperties { + AllowRefresh = false + }; await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, diff --git a/EnvelopeGenerator.Web/EnvelopeClaimTypes.cs b/EnvelopeGenerator.Web/EnvelopeClaimTypes.cs new file mode 100644 index 00000000..dc32c4cb --- /dev/null +++ b/EnvelopeGenerator.Web/EnvelopeClaimTypes.cs @@ -0,0 +1,13 @@ +namespace EnvelopeGenerator.Web +{ + /// + /// Provides custom claim types for envelope-related information. + /// + public static class EnvelopeClaimTypes + { + /// + /// Claim type for the title of an envelope. + /// + public static readonly string Title = $"Envelope{nameof(Title)}"; + } +} \ No newline at end of file diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 0f8f8cf6..63683680 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -129,7 +129,8 @@ try options.Cookie.HttpOnly = true; // Makes the cookie inaccessible to client-side scripts for security options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; // Ensures cookies are sent over HTTPS only options.Cookie.SameSite = SameSiteMode.Strict; // Protects against CSRF attacks by restricting how cookies are sent with requests from external sites - + options.ExpireTimeSpan = TimeSpan.FromMinutes(5); + options.Events = new CookieAuthenticationEvents { OnRedirectToLogin = context => diff --git a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml index 1c47d49c..7807ee45 100644 --- a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml +++ b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml @@ -22,6 +22,7 @@ + @await RenderSectionAsync("Scripts", required: false)
diff --git a/EnvelopeGenerator.Web/wwwroot/js/api.js b/EnvelopeGenerator.Web/wwwroot/js/api.js new file mode 100644 index 00000000..6a47cd3c --- /dev/null +++ b/EnvelopeGenerator.Web/wwwroot/js/api.js @@ -0,0 +1,7 @@ +const submitForm = async form => await fetch(form.action, { + method: form.method, + body: new FormData(form), + headers: { + "X-Requested-With": "XMLHttpRequest" + } +}) \ No newline at end of file diff --git a/EnvelopeGenerator.Web/wwwroot/js/ui.js b/EnvelopeGenerator.Web/wwwroot/js/ui.js index 7ebd9047..4f5af53b 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/ui.js +++ b/EnvelopeGenerator.Web/wwwroot/js/ui.js @@ -123,4 +123,4 @@ return annotationPresets } -} +} \ No newline at end of file From b594ddb646aa1107cc93c8a04d93e1ba54a0aa10 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 24 May 2024 13:42:20 +0200 Subject: [PATCH 17/30] Refaktorierung des HomeController zur Verbesserung der Fehlerbehandlung, des Authentifizierungsprozesses und der Verwaltung der Benutzersprache. --- EnvelopeGenerator.Web/Controllers/HomeController.cs | 12 ++++++++---- EnvelopeGenerator.Web/Program.cs | 5 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index 3124b938..daaf793a 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -164,7 +164,8 @@ namespace EnvelopeGenerator.Web.Controllers var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); var authProperties = new AuthenticationProperties { - AllowRefresh = false + AllowRefresh = false, + IsPersistent = false }; await HttpContext.SignInAsync( @@ -187,14 +188,17 @@ namespace EnvelopeGenerator.Web.Controllers else { database.Services.actionService.EnterIncorrectAccessCode(response.Envelope, response.Receiver); //for history - return Unauthorized(); - + Response.StatusCode = StatusCodes.Status401Unauthorized; + return View("EnvelopeLocked") + .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language); } }, Fail: (messages, notices) => { _logger.LogNotice(notices); - return Unauthorized(); + Response.StatusCode = StatusCodes.Status401Unauthorized; + return View("EnvelopeLocked") + .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language); }); } catch(Exception ex) diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 63683680..165a28d9 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -58,9 +58,8 @@ try { //remove option for Test*Controller options.Conventions.Add(new RemoveIfControllerConvention() - .AndIf(_ => !builder.IsDevOrDiP()) .AndIf(c => c.ControllerName.StartsWith("Test")) - .AndIf(_ => !config.GetValue("EnableTestControllers"))); + .AndIf(_ => !builder.IsDevOrDiP() || !config.GetValue("EnableTestControllers"))); }).AddJsonOptions(q => { // Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver @@ -129,7 +128,7 @@ try options.Cookie.HttpOnly = true; // Makes the cookie inaccessible to client-side scripts for security options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; // Ensures cookies are sent over HTTPS only options.Cookie.SameSite = SameSiteMode.Strict; // Protects against CSRF attacks by restricting how cookies are sent with requests from external sites - options.ExpireTimeSpan = TimeSpan.FromMinutes(5); + options.ExpireTimeSpan = TimeSpan.FromMinutes(30); options.Events = new CookieAuthenticationEvents { From 4c962740847a3697e5eb58ed97407e27aadf753e Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 24 May 2024 14:18:01 +0200 Subject: [PATCH 18/30] =?UTF-8?q?Meldung=20"Falscher=20Zugangscode"=20hinz?= =?UTF-8?q?ugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/Controllers/HomeController.cs | 6 ++++-- EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml | 4 ++++ EnvelopeGenerator.Web/WebKey.cs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index daaf793a..584b80d3 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -190,7 +190,8 @@ namespace EnvelopeGenerator.Web.Controllers database.Services.actionService.EnterIncorrectAccessCode(response.Envelope, response.Receiver); //for history Response.StatusCode = StatusCodes.Status401Unauthorized; return View("EnvelopeLocked") - .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language); + .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language) + .WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value); } }, Fail: (messages, notices) => @@ -198,7 +199,8 @@ namespace EnvelopeGenerator.Web.Controllers _logger.LogNotice(notices); Response.StatusCode = StatusCodes.Status401Unauthorized; return View("EnvelopeLocked") - .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language); + .WithData("UserLanguage", UserLanguage ?? _cultures.Default.Language) + .WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value); }); } catch(Exception ex) diff --git a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml index fbb03591..2ad82e76 100644 --- a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml @@ -24,6 +24,10 @@
+ @if (ViewData["ErrorMessage"] is string errMsg) + { +
@_sanitizer.Sanitize(errMsg)
+ }
diff --git a/EnvelopeGenerator.Web/WebKey.cs b/EnvelopeGenerator.Web/WebKey.cs index f65aeeee..87438283 100644 --- a/EnvelopeGenerator.Web/WebKey.cs +++ b/EnvelopeGenerator.Web/WebKey.cs @@ -16,5 +16,6 @@ public static readonly string LockedAccessCode = nameof(LockedAccessCode); public static readonly string LockedFooterTitle = nameof(LockedFooterTitle); public static readonly string LockedFooterBody = nameof(LockedFooterBody); + public static readonly string WrongAccessCode = nameof(WrongAccessCode); } } \ No newline at end of file From 42258cbbb82f5d2a5587c90b11f2a4bfdf97854b Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 24 May 2024 14:21:46 +0200 Subject: [PATCH 19/30] Aktualisierte EnvelopeLocked-Ansicht, um ein Verrutschen aufgrund einer Fehlermeldung zu verhindern --- EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml index 2ad82e76..a99c8941 100644 --- a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml @@ -24,10 +24,12 @@
- @if (ViewData["ErrorMessage"] is string errMsg) - { -
@_sanitizer.Sanitize(errMsg)
- } +
+ @if (ViewData["ErrorMessage"] is string errMsg) + { + @_sanitizer.Sanitize(errMsg) + } +
From 037ebfbe5cade81b910d8bd039167e1a3b68b7c2 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 27 May 2024 11:39:02 +0200 Subject: [PATCH 20/30] =?UTF-8?q?Schrieb=20die=20Schnittstellen=20des=20En?= =?UTF-8?q?velope=20Mail=20Service=20f=C3=BCr=20das=20Senden=20und=20Sende?= =?UTF-8?q?n=20von=20Zugangscode-Mails=20und=20injizierte=20Speicher-Cache?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IEnvelopeMailService.cs | 7 +++++- .../Services/EnvelopeMailService.cs | 23 ++++++++++++++++++- EnvelopeGenerator.Web/Program.cs | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs index 56d65cb6..7495f268 100644 --- a/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeMailService.cs @@ -1,8 +1,13 @@ -using DigitalData.EmailProfilerDispatcher.Application.Contracts; +using DigitalData.Core.DTO; +using DigitalData.EmailProfilerDispatcher.Application.Contracts; +using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Common; namespace EnvelopeGenerator.Application.Contracts { public interface IEnvelopeMailService : IEmailOutService { + Task> SendAsync(EnvelopeReceiverDto envelopeReceiverDto, Constants.EmailTemplateType tempType); + Task> SendAccessCodeAsync(EnvelopeReceiverDto envelopeReceiverDto); } } diff --git a/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs b/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs index 14841ffa..ba4fc73c 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeMailService.cs @@ -1,15 +1,36 @@ using AutoMapper; +using DigitalData.Core.DTO; +using DigitalData.EmailProfilerDispatcher.Application.DTOs.EmailOut; using DigitalData.EmailProfilerDispatcher.Application.Services; using DigitalData.EmailProfilerDispatcher.Infrastructure.Contracts; using DigitalData.UserManager.Application; using EnvelopeGenerator.Application.Contracts; +using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Common; +using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Localization; + namespace EnvelopeGenerator.Application.Services { public class EnvelopeMailService : EmailOutService, IEnvelopeMailService { - public EnvelopeMailService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper, IEmailTemplateService tempService) : base(repository, localizer, mapper) + private readonly IEmailTemplateService _tempService; + private readonly IMemoryCache _cache; + + public EnvelopeMailService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper, IEmailTemplateService tempService, IMemoryCache cache) : base(repository, localizer, mapper) { + _tempService = tempService; + _cache = cache; + } + + public Task> SendAccessCodeAsync(EnvelopeReceiverDto envelopeReceiverDto) + { + throw new NotImplementedException(); + } + + public Task> SendAsync(EnvelopeReceiverDto envelopeReceiverDto, Constants.EmailTemplateType tempType) + { + throw new NotImplementedException(); } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 165a28d9..bb73c019 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -176,6 +176,8 @@ try builder.Services.AddScoped(); builder.Services.AddDispatcher(); + builder.Services.AddMemoryCache(); + var app = builder.Build(); // Configure the HTTP request pipeline. From c3db8d0d004332ff99ea06975dd9b8a0b5371d00 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 27 May 2024 12:44:34 +0200 Subject: [PATCH 21/30] Flaggensymbol mit Bootstrap-Unterrand nach oben verschoben --- .../Views/Home/EnvelopeLocked.cshtml | 2 +- EnvelopeGenerator.Web/wwwroot/css/site.css | 44 +------------------ 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml index a99c8941..64884978 100644 --- a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml @@ -36,7 +36,7 @@
-
+