From a41d03aed514a11f8ed364aea7c1aca3f6f4b84d Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 16 Oct 2024 14:42:58 +0200 Subject: [PATCH] feat(HomeController): zentralisierte Standard-Kultur-Cookie-Zuweisung. --- .../Controllers/HomeController.cs | 29 +++++++++--------- .../Visualizers/attribcache140.bin | Bin 8437 -> 0 bytes 2 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 Visual Studio 2022/Visualizers/attribcache140.bin diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index e597b0a7..ffd3e8f0 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -48,10 +48,20 @@ namespace EnvelopeGenerator.Web.Controllers } [HttpGet("EnvelopeKey/{envelopeReceiverId}")] - public async Task MainAsync([FromRoute] string envelopeReceiverId) + public async Task MainAsync([FromRoute] string envelopeReceiverId, [FromQuery] string? culture = null) { try { + //TODO: add a middelware or use an asp.net functionality insead of this code-smell + culture = culture is not null ? _sanitizer.Sanitize(culture) : null; + envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId); + + if (UserLanguage is null && culture is null) + { + UserLanguage = _cultures.Default.Language; + return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}"); + } + envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId); if (!envelopeReceiverId.TryDecode(out var decoded)) @@ -99,22 +109,11 @@ namespace EnvelopeGenerator.Web.Controllers } [HttpGet("EnvelopeKey/{envelopeReceiverId}/Locked")] - public async Task EnvelopeLocked([FromRoute] string envelopeReceiverId, [FromQuery] string? culture = null) + public async Task EnvelopeLocked([FromRoute] string envelopeReceiverId) { try { - culture = culture is not null ? _sanitizer.Sanitize(culture) : null; - envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId); - - if (UserLanguage is null && culture is null) - { - UserLanguage = _cultures.Default.Language; - return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}"); - } - else if (UserLanguage is not null && culture is not null) - return Redirect($"Locked"); - - ViewData["UserCulture"] = _cultures[UserLanguage ?? culture]; + ViewData["UserCulture"] = _cultures[UserLanguage]; return await _envRcvService.IsExisting(envelopeReceiverId: envelopeReceiverId).ThenAsync( Success: isExisting => isExisting ? View().WithData("EnvelopeKey", envelopeReceiverId) : this.ViewEnvelopeNotFound(), @@ -311,6 +310,8 @@ namespace EnvelopeGenerator.Web.Controllers { try { + ViewData["UserCulture"] = _cultures[UserLanguage]; + readOnlyKey = _sanitizer.Sanitize(readOnlyKey); // check if the readOnlyId is valid diff --git a/Visual Studio 2022/Visualizers/attribcache140.bin b/Visual Studio 2022/Visualizers/attribcache140.bin deleted file mode 100644 index 304061068c0b0f0152f225dba3a67c28d5da4b76..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8437 zcmeHMOOxBi5e8F^OC>vrEXlH@*a@uIPGYYZ?b?c5s%)kB+=azg2=2o&`~blrcd{VB z41nFGSuCIPAMyioNmXt+=2ztIpOWsu3%18Rt^U1haac!GeK6M?hct9M& zs8!TzPB13S?Azp<-7k7yK5J5oxt=@pi^tRpOk4MZ0d!r}}e0sVH>tPv9) zqdn4g)MLUt&|`o1N%0Z>?WmQ&_5()t9TND=w0G1_(6_1ej7)p(IdS&;k3Jqg9zGfF z?hYP5GCww7fsOrXi^}S5z$`M%R$1(x=yX7~q5PfLGU@^v*pl*^Fjj9mAxhx`W7aaq zMBP{U?_8}1wk>Dmcs@r)<+nLz1{jY`J0KmCvTyd3!aZa5#SA8QoWIO>)ER$=<1a%| zH-xC#l|?4#FiPQdV>W9N&of6vtoL(4RGLh{P$rV)(%+TzYy>Xn__@Syr-)my?_7ol zDTa37w})NR8IfGJ`w<)U&&I^3RxY_zt4c4x70T1+gt@s45~M1a&GqYU;0$u;kRUB}2l9W98dH za_GKkowqLt8`|z=u2Ofz8sSeasq{QNQw`UQTi~sjTR)v40iL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