refactor(SendAccessCode): Prüfung hinzugefügt, ob die envelope-id schreibgeschützt ist. Wenn ja, Umleitung zu /ReadOnly
- Umbenannt in MainAsync
This commit is contained in:
parent
728385b70a
commit
210466883c
@ -44,11 +44,21 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}")]
|
||||
public async Task<IActionResult> SendAccessCode([FromRoute] string envelopeReceiverId)
|
||||
public async Task<IActionResult> MainAsync([FromRoute] string envelopeReceiverId)
|
||||
{
|
||||
try
|
||||
{
|
||||
envelopeReceiverId = _urlEncoder.Encode(envelopeReceiverId);
|
||||
|
||||
if (!envelopeReceiverId.TryDecode(out var decoded))
|
||||
{
|
||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||
return this.ViewDocumentNotFound();
|
||||
}
|
||||
|
||||
if(decoded.GetEncodeType() == EncodeType.ReadOnly)
|
||||
return Redirect($"{envelopeReceiverId}/ReadOnly");
|
||||
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
|
||||
return await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId).ThenAsync<EnvelopeReceiverDto, IActionResult>(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user