feat(ViewControllerBase): Erstellt, um allgemeine Eigenschaften von ViewControllern zu behandeln.
- Implementiert in TFARegController. - Implementiert in HomeController.
This commit is contained in:
@@ -21,35 +21,27 @@ using EnvelopeGenerator.Application.DTOs;
|
|||||||
using DigitalData.Core.Client;
|
using DigitalData.Core.Client;
|
||||||
using EnvelopeGenerator.Application.Extensions;
|
using EnvelopeGenerator.Application.Extensions;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers
|
namespace EnvelopeGenerator.Web.Controllers;
|
||||||
|
|
||||||
|
public class HomeController : ViewControllerBase
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILogger<HomeController> _logger;
|
|
||||||
private readonly EnvelopeOldService envelopeOldService;
|
private readonly EnvelopeOldService envelopeOldService;
|
||||||
private readonly IEnvelopeReceiverService _envRcvService;
|
private readonly IEnvelopeReceiverService _envRcvService;
|
||||||
private readonly IEnvelopeHistoryService _historyService;
|
private readonly IEnvelopeHistoryService _historyService;
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly HtmlSanitizer _sanitizer;
|
|
||||||
private readonly Cultures _cultures;
|
|
||||||
private readonly IEnvelopeMailService _mailService;
|
private readonly IEnvelopeMailService _mailService;
|
||||||
private readonly IEnvelopeReceiverReadOnlyService _readOnlyService;
|
private readonly IEnvelopeReceiverReadOnlyService _readOnlyService;
|
||||||
private readonly IAuthenticator _authenticator;
|
private readonly IAuthenticator _authenticator;
|
||||||
private readonly IReceiverService _rcvService;
|
private readonly IReceiverService _rcvService;
|
||||||
private readonly IEnvelopeSmsHandler _envSmsHandler;
|
private readonly IEnvelopeSmsHandler _envSmsHandler;
|
||||||
|
|
||||||
public HomeController(EnvelopeOldService envelopeOldService, ILogger<HomeController> logger, IEnvelopeReceiverService envelopeReceiverService, IEnvelopeHistoryService historyService, IStringLocalizer<Resource> localizer, IConfiguration configuration, HtmlSanitizer sanitizer, Cultures cultures, IEnvelopeMailService envelopeMailService, IEnvelopeReceiverReadOnlyService readOnlyService, IAuthenticator authenticator, IReceiverService receiverService, IEnvelopeSmsHandler envelopeSmsService)
|
public HomeController(EnvelopeOldService envelopeOldService, ILogger<HomeController> logger, IEnvelopeReceiverService envelopeReceiverService, IEnvelopeHistoryService historyService, IStringLocalizer<Resource> localizer, IConfiguration configuration, HtmlSanitizer sanitizer, Cultures cultures, IEnvelopeMailService envelopeMailService, IEnvelopeReceiverReadOnlyService readOnlyService, IAuthenticator authenticator, IReceiverService receiverService, IEnvelopeSmsHandler envelopeSmsService) : base(logger, sanitizer, cultures, localizer)
|
||||||
{
|
{
|
||||||
this.envelopeOldService = envelopeOldService;
|
this.envelopeOldService = envelopeOldService;
|
||||||
_envRcvService = envelopeReceiverService;
|
_envRcvService = envelopeReceiverService;
|
||||||
_historyService = historyService;
|
_historyService = historyService;
|
||||||
_localizer = localizer;
|
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_sanitizer = sanitizer;
|
|
||||||
_cultures = cultures;
|
|
||||||
_mailService = envelopeMailService;
|
_mailService = envelopeMailService;
|
||||||
_logger = logger;
|
|
||||||
_readOnlyService = readOnlyService;
|
_readOnlyService = readOnlyService;
|
||||||
_authenticator = authenticator;
|
_authenticator = authenticator;
|
||||||
_rcvService = receiverService;
|
_rcvService = receiverService;
|
||||||
@@ -564,5 +556,4 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error404() => this.ViewError404();
|
public IActionResult Error404() => this.ViewError404();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,26 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using EnvelopeGenerator.Application.Contracts;
|
||||||
|
using EnvelopeGenerator.Web.Models;
|
||||||
|
using Ganss.Xss;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using EnvelopeGenerator.Extensions;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using EnvelopeGenerator.Application.Resources;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Controllers;
|
namespace EnvelopeGenerator.Web.Controllers;
|
||||||
|
|
||||||
//TODO: Add authorization as well as limiting the link duration (intermediate token with different role)
|
//TODO: Add authorization as well as limiting the link duration (intermediate token with different role) or sign it
|
||||||
[Route("tfa")]
|
[Route("tfa")]
|
||||||
public class TFARegController : Controller
|
public class TFARegController : ViewControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("{key}")]
|
private readonly IEnvelopeReceiverService _erService;
|
||||||
public IActionResult Reg(string key)
|
|
||||||
|
public TFARegController(ILogger<TFARegController> logger, HtmlSanitizer sanitizer, Cultures cultures, IStringLocalizer<Resource> localizer, IEnvelopeReceiverService erService) : base(logger, sanitizer, cultures, localizer)
|
||||||
|
{
|
||||||
|
_erService = erService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{envelopeReceiverId}")]
|
||||||
|
public IActionResult Reg(string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|||||||
23
EnvelopeGenerator.Web/Controllers/ViewControllerBase.cs
Normal file
23
EnvelopeGenerator.Web/Controllers/ViewControllerBase.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using EnvelopeGenerator.Web.Models;
|
||||||
|
using Ganss.Xss;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using EnvelopeGenerator.Application.Resources;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Web.Controllers;
|
||||||
|
|
||||||
|
public class ViewControllerBase : Controller
|
||||||
|
{
|
||||||
|
protected readonly ILogger _logger;
|
||||||
|
protected readonly HtmlSanitizer _sanitizer;
|
||||||
|
protected readonly Cultures _cultures;
|
||||||
|
protected readonly IStringLocalizer<Resource> _localizer;
|
||||||
|
|
||||||
|
public ViewControllerBase(ILogger logger, HtmlSanitizer sanitizer, Cultures cultures, IStringLocalizer<Resource> localizer)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_sanitizer = sanitizer;
|
||||||
|
_cultures = cultures;
|
||||||
|
_localizer = localizer;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user