Compare commits
12 Commits
bd7c1d4e36
...
811656c4ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 811656c4ca | |||
| 7e90d25f0b | |||
| 20751aa708 | |||
| 51b96e2a81 | |||
| 7a011930df | |||
| a080aaec95 | |||
| d390802305 | |||
| 0b33ba0fd8 | |||
| 6778d8e3e7 | |||
| 3394a580f4 | |||
| 82a63b0dae | |||
| e61d626bf3 |
@@ -0,0 +1,19 @@
|
||||
using EnvelopeGenerator.Domain;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CreateDocStatusCommand : UpdateDocStatusCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets timestamp when this record was added. Returns the current date and time.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen => StatusChangedWhen;
|
||||
|
||||
/// <summary>
|
||||
/// Gets timestamp when this record was added. Returns the current date and time.
|
||||
/// </summary>
|
||||
public override DateTime? ChangedWhen { get; } = null;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using EnvelopeGenerator.Domain;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DocStatus.Commands;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class UpdateDocStatusCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the associated envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the receiver associated with this status.
|
||||
/// </summary>
|
||||
public int ReceiverId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current status code.
|
||||
/// </summary>
|
||||
public Constants.DocumentStatus Status => Value is null ? Constants.DocumentStatus.Created : Constants.DocumentStatus.Signed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timestamp when the status was changed. Retrns the AddedWhen value.
|
||||
/// </summary>
|
||||
public DateTime StatusChangedWhen { get; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display value associated with the status.
|
||||
/// </summary>
|
||||
public string? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets timestamp when this record was added. Returns the current date and time.
|
||||
/// </summary>
|
||||
public virtual DateTime? ChangedWhen { get; } = DateTime.Now;
|
||||
}
|
||||
@@ -95,6 +95,7 @@ public static class Extensions
|
||||
/// </summary>
|
||||
/// <param name="mediator"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public static Task<EnvelopeReceiverDto?> ReadEnvelopeReceiverAsync(this IMediator mediator, string key, CancellationToken cancel = default)
|
||||
{
|
||||
|
||||
@@ -44,9 +44,10 @@ public static class ReceiverAlreadySignedQueryExtensions
|
||||
/// </summary>
|
||||
/// <param name="mediator"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public static Task<bool> ReceiverAlreadySigned(IMediator mediator, string key)
|
||||
=> mediator.Send(new ReceiverAlreadySignedQuery { Key = key });
|
||||
public static Task<bool> ReceiverAlreadySigned(this IMediator mediator, string key, CancellationToken cancel = default)
|
||||
=> mediator.Send(new ReceiverAlreadySignedQuery { Key = key }, cancel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class Key
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string InnerServiceError = nameof(InnerServiceError);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string EnvelopeNotFound = nameof(EnvelopeNotFound);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string EnvelopeReceiverNotFound = nameof(EnvelopeReceiverNotFound);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string AccessCodeNull = nameof(AccessCodeNull);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string WrongAccessCode = nameof(WrongAccessCode);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string DataIntegrityIssue = nameof(DataIntegrityIssue);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string SecurityBreachOrDataIntegrity = nameof(SecurityBreachOrDataIntegrity);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string PossibleDataIntegrityIssue = nameof(PossibleDataIntegrityIssue);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string SecurityBreach = nameof(SecurityBreach);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string PossibleSecurityBreach = nameof(PossibleSecurityBreach);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string WrongEnvelopeReceiverId = nameof(WrongEnvelopeReceiverId);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string EnvelopeOrReceiverNonexists = nameof(EnvelopeOrReceiverNonexists);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string PhoneNumberNonexists = nameof(PhoneNumberNonexists);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string Default = nameof(Default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string DbMigrationTest = nameof(DbMigrationTest);
|
||||
}
|
||||
@@ -1,9 +1,366 @@
|
||||
namespace EnvelopeGenerator.Application.Resources
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// The place holder class for Resource.*.resx
|
||||
/// </summary>
|
||||
public class Resource
|
||||
{
|
||||
}
|
||||
|
||||
//TODO: use code generator
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// The place holder class for Resource.*.resx
|
||||
///
|
||||
/// </summary>
|
||||
public class Resource
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string InnerServiceError(this IStringLocalizer localizer) => localizer[nameof(InnerServiceError)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnvelopeNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeNotFound)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnvelopeReceiverNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeReceiverNotFound)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string AccessCodeNull(this IStringLocalizer localizer) => localizer[nameof(AccessCodeNull)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string WrongAccessCode(this IStringLocalizer localizer) => localizer[nameof(WrongAccessCode)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(DataIntegrityIssue)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string SecurityBreachOrDataIntegrity(this IStringLocalizer localizer) => localizer[nameof(SecurityBreachOrDataIntegrity)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string PossibleDataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(PossibleDataIntegrityIssue)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string SecurityBreach(this IStringLocalizer localizer) => localizer[nameof(SecurityBreach)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string PossibleSecurityBreach(this IStringLocalizer localizer) => localizer[nameof(PossibleSecurityBreach)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string WrongEnvelopeReceiverId(this IStringLocalizer localizer) => localizer[nameof(WrongEnvelopeReceiverId)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnvelopeOrReceiverNonexists(this IStringLocalizer localizer) => localizer[nameof(EnvelopeOrReceiverNonexists)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string PhoneNumberNonexists(this IStringLocalizer localizer) => localizer[nameof(PhoneNumberNonexists)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Default(this IStringLocalizer localizer) => localizer[nameof(Default)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DbMigrationTest(this IStringLocalizer localizer) => localizer[nameof(DbMigrationTest)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Culture(this IStringLocalizer localizer) => localizer[nameof(Culture)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string FiClass(this IStringLocalizer localizer) => localizer[nameof(FiClass)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string ServiceOutputNullError(this IStringLocalizer localizer) => localizer[nameof(ServiceOutputNullError)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string UnexpectedError(this IStringLocalizer localizer) => localizer[nameof(UnexpectedError)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string FailedToSendAccessCode(this IStringLocalizer localizer) => localizer[nameof(FailedToSendAccessCode)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DataIntegrityError(this IStringLocalizer localizer) => localizer[nameof(DataIntegrityError)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string NonDecodableEnvelopeReceiverId(this IStringLocalizer localizer) => localizer[nameof(NonDecodableEnvelopeReceiverId)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DeDE(this IStringLocalizer localizer) => localizer["de-DE"].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnUS(this IStringLocalizer localizer) => localizer["en-US"].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string SignDoc(this IStringLocalizer localizer) => localizer[nameof(SignDoc)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DocRejected(this IStringLocalizer localizer) => localizer[nameof(DocRejected)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DocSigned(this IStringLocalizer localizer) => localizer[nameof(DocSigned)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string DocProtected(this IStringLocalizer localizer) => localizer[nameof(DocProtected)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Complete(this IStringLocalizer localizer) => localizer[nameof(Complete)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnvelopeInfo1(this IStringLocalizer localizer) => localizer[nameof(EnvelopeInfo1)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string EnvelopeInfo2(this IStringLocalizer localizer) => localizer[nameof(EnvelopeInfo2)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string SigAgree(this IStringLocalizer localizer) => localizer[nameof(SigAgree)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Reject(this IStringLocalizer localizer) => localizer[nameof(Reject)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string And(this IStringLocalizer localizer) => localizer["and"].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Hello(this IStringLocalizer localizer) => localizer[nameof(Hello)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string RejectionInfo1(this IStringLocalizer localizer) => localizer[nameof(RejectionInfo1)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string RejectionInfo2(this IStringLocalizer localizer) => localizer[nameof(RejectionInfo2)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string RejectionInfo1Ext(this IStringLocalizer localizer) => localizer["RejectionInfo1_ext"].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string RejectionInfo2Ext(this IStringLocalizer localizer) => localizer["RejectionInfo2_ext"].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string SigningProcessTitle(this IStringLocalizer localizer) => localizer[nameof(SigningProcessTitle)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string WelcomeToTheESignPortal(this IStringLocalizer localizer) => localizer[nameof(WelcomeToTheESignPortal)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string ViewDoc(this IStringLocalizer localizer) => localizer[nameof(ViewDoc)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string HomePageDescription(this IStringLocalizer localizer) => localizer[nameof(HomePageDescription)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <returns></returns>
|
||||
public static string Privacy(this IStringLocalizer localizer) => localizer[nameof(Privacy)].Value;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <param name="arg0"></param>
|
||||
/// <returns></returns>
|
||||
public static string LockedTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(Privacy)].Value, arg0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <param name="arg0"></param>
|
||||
/// <returns></returns>
|
||||
public static string LockedBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedBody)].Value, arg0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <param name="arg0"></param>
|
||||
/// <returns></returns>
|
||||
public static string LockedCodeLabel(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedCodeLabel)].Value, arg0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <param name="arg0"></param>
|
||||
/// <returns></returns>
|
||||
public static string LockedFooterTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterTitle)].Value, arg0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localizer"></param>
|
||||
/// <param name="arg0"></param>
|
||||
/// <returns></returns>
|
||||
public static string LockedFooterBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterBody)].Value, arg0);
|
||||
}
|
||||
@@ -129,6 +129,9 @@
|
||||
<data name="Confirmation" xml:space="preserve">
|
||||
<value>Bestätigung</value>
|
||||
</data>
|
||||
<data name="Culture" xml:space="preserve">
|
||||
<value>de-DE</value>
|
||||
</data>
|
||||
<data name="de-DE" xml:space="preserve">
|
||||
<value>Deutch</value>
|
||||
</data>
|
||||
@@ -150,6 +153,9 @@
|
||||
<data name="EnvelopeInfo2" xml:space="preserve">
|
||||
<value>Erstellt am {0} von {1}. Sie können den Absender über <span class="highlight highlight-envelope-info-2"><a class="mail-link" href="mailto:{2}?subject={3}&body=Sehr%20geehrter%20{4}%20{5},%0A%0A%0A">{6}</a></span> kontaktieren.</value>
|
||||
</data>
|
||||
<data name="FiClass" xml:space="preserve">
|
||||
<value>fi-de</value>
|
||||
</data>
|
||||
<data name="Finalize" xml:space="preserve">
|
||||
<value>Abschließen</value>
|
||||
</data>
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
<data name="Confirmation" xml:space="preserve">
|
||||
<value>Confirmation</value>
|
||||
</data>
|
||||
<data name="Culture" xml:space="preserve">
|
||||
<value>en-US</value>
|
||||
</data>
|
||||
<data name="de-DE" xml:space="preserve">
|
||||
<value>German</value>
|
||||
</data>
|
||||
@@ -150,6 +153,9 @@
|
||||
<data name="EnvelopeInfo2" xml:space="preserve">
|
||||
<value>Created on {0} by {1}. You can contact the sender via <span class="highlight highlight-envelope-info-2"><a class="mail-link" href="mailto:{2}?subject={3}&body=Dear%20{4}%20{5},%0A%0A%0A">{6}</a></span>.</value>
|
||||
</data>
|
||||
<data name="FiClass" xml:space="preserve">
|
||||
<value>fi-us</value>
|
||||
</data>
|
||||
<data name="Finalize" xml:space="preserve">
|
||||
<value>Finalize</value>
|
||||
</data>
|
||||
|
||||
@@ -36,7 +36,7 @@ public class EmailTemplateService : BasicCRUDService<IEmailTemplateRepository, E
|
||||
var temp = await _repository.ReadByNameAsync(type);
|
||||
return temp is null
|
||||
? Result.Fail<EmailTemplateDto>()
|
||||
.Message(Key.InnerServiceError)
|
||||
.Message("InnerServiceError")
|
||||
.Notice(LogLevel.Error, Flag.DataIntegrityIssue, $"EmailTemplateType '{type}' is not found in DB. Please, define required e-mail template.")
|
||||
: Result.Success(_mapper.Map<EmailTemplateDto>(temp));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
var env_rcvs = await _repository.ReadByUuidAsync(uuid: uuid, withEnvelope: withEnvelope, withReceiver: withReceiver);
|
||||
if( env_rcvs is null || !env_rcvs.Any())
|
||||
return Result.Fail<IEnumerable<string?>>()
|
||||
.Message(_localizer[Key.EnvelopeReceiverNotFound]);
|
||||
.Message(_localizer.EnvelopeReceiverNotFound());
|
||||
return Result.Success(env_rcvs.Select(er => er.AccessCode) ?? Enumerable.Empty<string?>());
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
var env_rcv = await _repository.ReadByUuidSignatureAsync(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly);
|
||||
if (env_rcv is null)
|
||||
return Result.Fail<EnvelopeReceiverDto>()
|
||||
.Message(Key.EnvelopeReceiverNotFound);
|
||||
.Message("EnvelopeReceiverNotFound");
|
||||
|
||||
return Result.Success(_mapper.Map<EnvelopeReceiverDto>(env_rcv));
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
var env_rcv = await _repository.ReadByUuidSignatureAsync(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly);
|
||||
if (env_rcv is null)
|
||||
return Result.Fail<EnvelopeReceiverSecretDto>()
|
||||
.Message(Key.EnvelopeReceiverNotFound);
|
||||
.Message("EnvelopeReceiverNotFound");
|
||||
|
||||
return Result.Success(_mapper.Map<EnvelopeReceiverSecretDto>(env_rcv));
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
return Result.Fail<EnvelopeReceiverDto>()
|
||||
.Message(_localizer[Key.WrongEnvelopeReceiverId])
|
||||
.Message(_localizer.WrongEnvelopeReceiverId())
|
||||
.Notice(LogLevel.Warning, (uuid, signature).ToTitle())
|
||||
.Notice(LogLevel.Warning, EnvelopeFlag.WrongEnvelopeReceiverId)
|
||||
.Notice(LogLevel.Warning, Flag.PossibleSecurityBreach);
|
||||
@@ -159,7 +159,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
|
||||
if (er is null)
|
||||
return Result.Fail<bool>()
|
||||
.Message(_localizer[Key.EnvelopeOrReceiverNonexists])
|
||||
.Message(_localizer.EnvelopeOrReceiverNonexists())
|
||||
.Notice(LogLevel.Warning, (uuid, signature).ToTitle())
|
||||
.Notice(LogLevel.Warning, EnvelopeFlag.EnvelopeOrReceiverNonexists)
|
||||
.Notice(LogLevel.Warning, Flag.PossibleDataIntegrityIssue);
|
||||
@@ -168,13 +168,13 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
|
||||
if (actualAccessCode is null)
|
||||
return Result.Fail<bool>()
|
||||
.Message(_localizer[Key.AccessCodeNull])
|
||||
.Message(_localizer.AccessCodeNull())
|
||||
.Notice(LogLevel.Critical, (uuid, signature).ToTitle())
|
||||
.Notice(LogLevel.Critical, EnvelopeFlag.AccessCodeNull)
|
||||
.Notice(LogLevel.Critical, Flag.DataIntegrityIssue);
|
||||
|
||||
else if (accessCode != actualAccessCode)
|
||||
return Result.Success(false).Message(_localizer[Key.WrongAccessCode]);
|
||||
return Result.Success(false).Message(_localizer.WrongAccessCode());
|
||||
else
|
||||
return Result.Success(true);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
return Result.Fail<bool>()
|
||||
.Message(Key.WrongEnvelopeReceiverId)
|
||||
.Message("WrongEnvelopeReceiverId")
|
||||
.Notice(LogLevel.Critical, EnvelopeFlag.WrongEnvelopeReceiverId)
|
||||
.Notice(LogLevel.Critical, Flag.SecurityBreach)
|
||||
.Notice(LogLevel.Critical, "Attempt to verify access code detected. Such actions are generally not initiated by well-intentioned users. Potential security breach suspected. Immediate investigation required.");
|
||||
@@ -287,7 +287,7 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
return Result.Fail<SmsResponse>()
|
||||
.Message(_localizer[Key.WrongEnvelopeReceiverId])
|
||||
.Message(_localizer.WrongEnvelopeReceiverId())
|
||||
.Notice(LogLevel.Warning, (uuid, signature).ToTitle())
|
||||
.Notice(LogLevel.Warning, EnvelopeFlag.WrongEnvelopeReceiverId)
|
||||
.Notice(LogLevel.Warning, Flag.PossibleSecurityBreach);
|
||||
@@ -295,11 +295,11 @@ public class EnvelopeReceiverService : BasicCRUDService<IEnvelopeReceiverReposit
|
||||
var env_rcv = await _repository.ReadByUuidSignatureAsync(uuid: uuid, signature: signature, withEnvelope: false, withReceiver: false);
|
||||
if (env_rcv is null)
|
||||
return Result.Fail<SmsResponse>()
|
||||
.Message(Key.EnvelopeReceiverNotFound);
|
||||
.Message("EnvelopeReceiverNotFound");
|
||||
|
||||
if (env_rcv.PhoneNumber is null)
|
||||
return Result.Fail<SmsResponse>()
|
||||
.Message(Key.PhoneNumberNonexists)
|
||||
.Message("PhoneNumberNonexists")
|
||||
.Notice(LogLevel.Error, Flag.NotFound, $"An attempt was made to send sms to the user whose phone number is null. Envelope recipient ID is {envelopeReceiverId}, UUID is {uuid} and signature is {signature}.");
|
||||
|
||||
var res = await _smsSender.SendSmsAsync(recipient: env_rcv.PhoneNumber, message: message);
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
public static class ControllerBaseExtensions
|
||||
{
|
||||
#region Auth
|
||||
public static string? GetClaimValue(this ControllerBase controller, string claimType) => controller.User.FindFirstValue(claimType);
|
||||
|
||||
public static string? GetAuthEnvelopeUuid(this ControllerBase controller) => controller.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
public static string? GetAuthReceiverSignature(this ControllerBase controller) => controller.User.FindFirstValue(ClaimTypes.Hash);
|
||||
|
||||
public static string? GetAuthReceiverName(this ControllerBase controller) => controller.User.FindFirstValue(ClaimTypes.Name);
|
||||
|
||||
public static string? GetAuthReceiverMail(this ControllerBase controller) => controller.User.FindFirstValue(ClaimTypes.Email);
|
||||
|
||||
public static string? GetAuthEnvelopeTitle(this ControllerBase controller) => controller.User.FindFirstValue(EnvelopeClaimTypes.Title);
|
||||
|
||||
public static int? GetAuthEnvelopeId(this ControllerBase controller)
|
||||
{
|
||||
var env_id_str = controller.User.FindFirstValue(EnvelopeClaimTypes.Id);
|
||||
return int.TryParse(env_id_str, out int env_id) ? env_id : null;
|
||||
}
|
||||
|
||||
public static async Task SignInEnvelopeAsync(this HttpContext context, EnvelopeReceiverDto er, string receiverRole)
|
||||
{
|
||||
var claims = new List<Claim> {
|
||||
new(ClaimTypes.NameIdentifier, er.Envelope!.Uuid),
|
||||
new(ClaimTypes.Hash, er.Receiver!.Signature),
|
||||
new(ClaimTypes.Name, er.Name ?? string.Empty),
|
||||
new(ClaimTypes.Email, er.Receiver.EmailAddress),
|
||||
new(EnvelopeClaimTypes.Title, er.Envelope.Title),
|
||||
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString()),
|
||||
new(ClaimTypes.Role, receiverRole)
|
||||
};
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
AllowRefresh = false,
|
||||
IsPersistent = false
|
||||
};
|
||||
|
||||
await context.SignInAsync(
|
||||
CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region View error
|
||||
//TODO: integrate localizer for ready-to-use views
|
||||
//TODO: integrate to global exception handler middleware
|
||||
public static ViewResult ViewError(this Controller controller, ErrorViewModel errorViewModel) => controller.View("_Error", errorViewModel);
|
||||
|
||||
public static ViewResult ViewError404(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Die von Ihnen gesuchte Seite ist nicht verfügbar",
|
||||
Body = "Sie können derzeit nur an Sie gerichtete Briefe einsehen und unterschreiben.",
|
||||
});
|
||||
|
||||
public static ViewResult ViewEnvelopeNotFound(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Document not found",
|
||||
Body = "Wenn Sie diese URL in Ihrer E-Mail erhalten haben, wenden Sie sich bitte an das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewDocumentNotFound(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Umschlag nicht gefunden",
|
||||
Body = "Wenn Sie diese URL in Ihrer E-Mail erhalten haben, wenden Sie sich bitte an das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewAccessCodeNotSent(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "500",
|
||||
Subtitle = "Der Zugangscode konnte nicht gesendet werden",
|
||||
Body = "Bitte kontaktieren Sie das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewInnerServiceError(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "500",
|
||||
Subtitle = "Ein unerwarteter Fehler ist aufgetreten",
|
||||
Body = "Bitte kontaktieren Sie das IT-Team."
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -15,25 +15,18 @@ public class DocumentController : BaseController
|
||||
{
|
||||
private readonly EnvelopeOldService envelopeService;
|
||||
private readonly ActionService? actionService;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IEnvelopeDocumentService _envDocService;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public DocumentController(DatabaseService database, EnvelopeOldService envelope, IEnvelopeDocumentService envDocService, ILogger<DocumentController> logger) : base(database, logger)
|
||||
public DocumentController(DatabaseService database, EnvelopeOldService envelope, ILogger<DocumentController> logger) : base(database, logger)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
actionService = database.Services?.actionService;
|
||||
_envDocService = envDocService;
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
[NonAction]
|
||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
||||
{
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeReceiver response = await envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
// Load document info
|
||||
var document = await envelopeService.GetDocument(index, envelopeKey);
|
||||
|
||||
@@ -43,23 +36,4 @@ public class DocumentController : BaseController
|
||||
// Return the document as bytes
|
||||
return File(bytes, "application/octet-stream");
|
||||
}
|
||||
|
||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||
[HttpPost("{envelopeKey}")]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> Open(string envelopeKey)
|
||||
{
|
||||
var authSignature = this.GetAuthReceiverSignature();
|
||||
|
||||
if (authSignature != envelopeKey.GetReceiverSignature())
|
||||
return Forbid();
|
||||
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeReceiver response = await envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
actionService?.OpenEnvelope(response.Envelope, response.Receiver);
|
||||
|
||||
return Ok(new object());
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Domain;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
@@ -23,44 +25,23 @@ public class EnvelopeController : BaseController
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IEnvelopeHistoryService _histService;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IReceiverService _receiverService;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IEnvelopeReceiverService _envRcvService;
|
||||
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public EnvelopeController(DatabaseService database,
|
||||
EnvelopeOldService envelope,
|
||||
ILogger<EnvelopeController> logger, UrlEncoder urlEncoder,
|
||||
IEnvelopeHistoryService envelopeHistoryService,
|
||||
IReceiverService receiverService,
|
||||
IEnvelopeReceiverService envelopeReceiverService) : base(database, logger)
|
||||
IEnvelopeReceiverService envelopeReceiverService, IMediator mediator) : base(database, logger)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
actionService = database?.Services?.actionService;
|
||||
_urlEncoder = urlEncoder;
|
||||
_histService = envelopeHistoryService;
|
||||
_receiverService = receiverService;
|
||||
_envRcvService = envelopeReceiverService;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey)
|
||||
{
|
||||
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
||||
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
|
||||
EnvelopeReceiver response = await envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
if (envelopeService.ReceiverAlreadySigned(response.Envelope, response.Receiver.Id) == true)
|
||||
{
|
||||
return Problem(statusCode: 403);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Loaded envelope [{0}] for receiver [{1}]", response.Envelope.Id, response.Envelope.Id);
|
||||
return Json(response);
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||
@@ -70,13 +51,11 @@ public class EnvelopeController : BaseController
|
||||
{
|
||||
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
||||
|
||||
var authSignature = this.GetAuthReceiverSignature();
|
||||
var authSignature = User.GetAuthReceiverSignature();
|
||||
|
||||
if (authSignature != envelopeKey.GetReceiverSignature())
|
||||
return Unauthorized();
|
||||
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeReceiver response = await envelopeService.LoadEnvelope(envelopeKey);
|
||||
|
||||
// Again check if receiver has already signed
|
||||
@@ -107,9 +86,9 @@ public class EnvelopeController : BaseController
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public async Task<IActionResult> Reject([FromBody] string? reason = null)
|
||||
{
|
||||
var signature = this.GetAuthReceiverSignature();
|
||||
var uuid = this.GetAuthEnvelopeUuid();
|
||||
var mail = this.GetAuthReceiverMail();
|
||||
var signature = User.GetAuthReceiverSignature();
|
||||
var uuid = User.GetAuthEnvelopeUuid();
|
||||
var mail = User.GetAuthReceiverMail();
|
||||
if (uuid is null || signature is null || mail is null)
|
||||
{
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature,
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
using EnvelopeGenerator.Web.Services;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Extensions;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
|
||||
using Ganss.Xss;
|
||||
using Newtonsoft.Json;
|
||||
using EnvelopeGenerator.Application.Dto;
|
||||
using DigitalData.Core.Client;
|
||||
using OtpNet;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using MediatR;
|
||||
using EnvelopeGenerator.Application.Dto;
|
||||
using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Application.EnvelopeReceivers.Queries;
|
||||
using EnvelopeGenerator.Application.Extensions;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using EnvelopeGenerator.Extensions;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using Ganss.Xss;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Newtonsoft.Json;
|
||||
using OtpNet;
|
||||
using System.Security.Claims;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
public class HomeController : ViewControllerBase
|
||||
{
|
||||
private readonly EnvelopeOldService envelopeOldService;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IEnvelopeReceiverService _envRcvService;
|
||||
[Obsolete("Use MediatR")]
|
||||
@@ -46,9 +43,8 @@ public class HomeController : ViewControllerBase
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
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, IMediator mediator) : base(logger, sanitizer, cultures, localizer)
|
||||
public HomeController(ILogger<HomeController> logger, IEnvelopeReceiverService envelopeReceiverService, IEnvelopeHistoryService historyService, IStringLocalizer<Resource> localizer, IConfiguration configuration, Cultures cultures, IEnvelopeMailService envelopeMailService, IEnvelopeReceiverReadOnlyService readOnlyService, IAuthenticator authenticator, IReceiverService receiverService, IEnvelopeSmsHandler envelopeSmsService, IMediator mediator) : base(logger, cultures, localizer)
|
||||
{
|
||||
this.envelopeOldService = envelopeOldService;
|
||||
_envRcvService = envelopeReceiverService;
|
||||
_historyService = historyService;
|
||||
_configuration = configuration;
|
||||
@@ -61,19 +57,8 @@ public class HomeController : ViewControllerBase
|
||||
}
|
||||
|
||||
[HttpGet("/")]
|
||||
public IActionResult Main([FromQuery] string? culture = null)
|
||||
public IActionResult Main()
|
||||
{
|
||||
//TODO: add a middelware or use an asp.net functionality insead of this code-smell
|
||||
culture = culture is not null ? _sanitizer.Sanitize(culture) : null;
|
||||
|
||||
if (UserLanguage is null && culture is null)
|
||||
{
|
||||
UserLanguage = _cultures.Default.Language;
|
||||
return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}");
|
||||
}
|
||||
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
|
||||
return View(new MainViewModel()
|
||||
{
|
||||
Title = _configuration["MainPageTitle"]
|
||||
@@ -82,22 +67,10 @@ public class HomeController : ViewControllerBase
|
||||
|
||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}")]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> MainAsync([FromRoute] string envelopeReceiverId, [FromQuery] string? culture = null)
|
||||
public async Task<IActionResult> MainAsync([FromRoute] string envelopeReceiverId)
|
||||
{
|
||||
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))
|
||||
{
|
||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||
@@ -131,7 +104,7 @@ public class HomeController : ViewControllerBase
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, exception:ex, message: _localizer[WebKey.UnexpectedError]);
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, exception:ex, message: _localizer.UnexpectedError());
|
||||
return this.ViewInnerServiceError();
|
||||
}
|
||||
}
|
||||
@@ -142,8 +115,6 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
|
||||
return await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId).ThenAsync(
|
||||
SuccessAsync: async er => {
|
||||
if (User.IsInRole(ReceiverRole.FullyAuth))
|
||||
@@ -175,15 +146,12 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
|
||||
envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId);
|
||||
(string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId();
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
{
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer[WebKey.WrongEnvelopeReceiverId]);
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer.WrongEnvelopeReceiverId());
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
@@ -272,7 +240,7 @@ public class HomeController : ViewControllerBase
|
||||
.WithData("HasPhoneNumber", er_secret.HasPhoneNumber)
|
||||
.WithData("SenderEmail", er_secret.Envelope.User!.Email)
|
||||
.WithData("EnvelopeTitle", er_secret.Envelope.Title)
|
||||
.WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value);
|
||||
.WithData("ErrorMessage", _localizer.WrongAccessCode());
|
||||
}
|
||||
|
||||
await _historyService.RecordAsync(er_secret.EnvelopeId, er_secret.Receiver!.EmailAddress, EnvelopeStatus.AccessCodeCorrect);
|
||||
@@ -304,7 +272,7 @@ public class HomeController : ViewControllerBase
|
||||
if (!User.IsInRole(ReceiverRole.PreAuth) || !_envSmsHandler.VerifyTotp(auth.SmsCode!, er_secret.Receiver.TotpSecretkey))
|
||||
{
|
||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||
ViewData["ErrorMessage"] = _localizer[WebKey.WrongAccessCode].Value;
|
||||
ViewData["ErrorMessage"] = _localizer.WrongAccessCode();
|
||||
return await TFAViewAsync(viaSms: true, er_secret, envelopeReceiverId);
|
||||
}
|
||||
|
||||
@@ -320,7 +288,7 @@ public class HomeController : ViewControllerBase
|
||||
if (!User.IsInRole(ReceiverRole.PreAuth) || !_authenticator.VerifyTotp(auth.AuthenticatorCode!, er_secret.Receiver.TotpSecretkey, window: VerificationWindow.RfcSpecifiedNetworkDelay))
|
||||
{
|
||||
Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||
ViewData["ErrorMessage"] = _localizer[WebKey.WrongAccessCode].Value;
|
||||
ViewData["ErrorMessage"] = _localizer.WrongAccessCode();
|
||||
return await TFAViewAsync(viaSms: false, er_secret, envelopeReceiverId);
|
||||
}
|
||||
|
||||
@@ -334,15 +302,12 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
|
||||
envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId);
|
||||
(string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId();
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
{
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer[WebKey.WrongEnvelopeReceiverId]);
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer.WrongEnvelopeReceiverId());
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
@@ -389,7 +354,7 @@ public class HomeController : ViewControllerBase
|
||||
.WithData("HasPhoneNumber", er_secret.HasPhoneNumber)
|
||||
.WithData("SenderEmail", er_secret.Envelope.User!.Email)
|
||||
.WithData("EnvelopeTitle", er_secret.Envelope.Title)
|
||||
.WithData("ErrorMessage", _localizer[WebKey.WrongAccessCode].Value);
|
||||
.WithData("ErrorMessage", _localizer.WrongEnvelopeReceiverId());
|
||||
}
|
||||
|
||||
await HttpContext.SignInEnvelopeAsync(er_secret, ReceiverRole.FullyAuth);
|
||||
@@ -406,23 +371,21 @@ public class HomeController : ViewControllerBase
|
||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId)
|
||||
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId, CancellationToken cancel)
|
||||
{
|
||||
try
|
||||
{
|
||||
envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId);
|
||||
return await _envRcvService.IsExisting(envelopeReceiverId: envelopeReceiverId).ThenAsync(
|
||||
SuccessAsync: (Func<bool, Task<IActionResult>>)(async isExisting =>
|
||||
{
|
||||
if(!isExisting)
|
||||
return this.ViewEnvelopeNotFound();
|
||||
|
||||
EnvelopeReceiver response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
|
||||
if (!envelopeOldService.ReceiverAlreadySigned((Envelope)response.Envelope, (int)response.Receiver.Id))
|
||||
var signed = await _mediator.ReceiverAlreadySigned(envelopeReceiverId, cancel);
|
||||
if (signed)
|
||||
return base.Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
return base.View();
|
||||
}),
|
||||
@@ -446,14 +409,10 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId);
|
||||
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
return await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId).ThenAsync(
|
||||
SuccessAsync: async (er) =>
|
||||
{
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
return await _historyService.IsRejected(envelopeId: er.EnvelopeId)
|
||||
? View(er)
|
||||
: Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
@@ -478,10 +437,6 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
ViewData["UserCulture"] = _cultures[UserLanguage];
|
||||
|
||||
readOnlyKey = _sanitizer.Sanitize(readOnlyKey);
|
||||
|
||||
// check if the readOnlyId is valid
|
||||
if (!readOnlyKey.TryDecode(out var decodedKeys) || decodedKeys.GetEncodeType() != EncodeType.EnvelopeReceiverReadOnly)
|
||||
{
|
||||
@@ -507,8 +462,6 @@ public class HomeController : ViewControllerBase
|
||||
{
|
||||
var envelopeKey = (er.Envelope!.Uuid, er.Receiver!.Signature).EncodeEnvelopeReceiverId();
|
||||
|
||||
EnvelopeReceiver response = await envelopeOldService.LoadEnvelope(envelopeKey);
|
||||
|
||||
//TODO: implement multi-threading to history process (Task)
|
||||
var hist_res = await _historyService.RecordAsync((int)erro.EnvelopeId, erro.AddedWho, EnvelopeStatus.EnvelopeViewed);
|
||||
if (hist_res.IsFailed)
|
||||
@@ -556,16 +509,15 @@ public class HomeController : ViewControllerBase
|
||||
return Ok(new { EnvelopeUuid = envelopeUuid, ReceiverSignature = receiverSignature });
|
||||
}
|
||||
|
||||
[HttpPost("lang/{language}")]
|
||||
public IActionResult SetLanguage([FromRoute] string language)
|
||||
[HttpPost("lang/{culture}")]
|
||||
public IActionResult SetLanguage([FromRoute] string culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
language = _sanitizer.Sanitize(language);
|
||||
if (!_cultures.Languages.Contains(language))
|
||||
if (!_cultures.Languages.Contains(culture))
|
||||
return BadRequest();
|
||||
|
||||
UserLanguage = language;
|
||||
Response.Cookies.SetCulture(culture);
|
||||
|
||||
return Redirect(Request.Headers["Referer"].ToString());
|
||||
}
|
||||
@@ -579,39 +531,5 @@ public class HomeController : ViewControllerBase
|
||||
[HttpGet("lang")]
|
||||
public IActionResult GetLanguages() => Ok(_cultures.Languages);
|
||||
|
||||
private string? UserLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
var cookieValue = Request.Cookies[CookieRequestCultureProvider.DefaultCookieName];
|
||||
|
||||
if (string.IsNullOrEmpty(cookieValue))
|
||||
return null;
|
||||
|
||||
var culture = CookieRequestCultureProvider.ParseCookieValue(cookieValue)?.Cultures[0];
|
||||
return culture?.Value ?? null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(value is null)
|
||||
Response.Cookies.Delete(CookieRequestCultureProvider.DefaultCookieName);
|
||||
else
|
||||
{
|
||||
var cookieOptions = new CookieOptions()
|
||||
{
|
||||
Expires = DateTimeOffset.UtcNow.AddYears(1),
|
||||
Secure = false,
|
||||
SameSite = SameSiteMode.Strict,
|
||||
HttpOnly = true
|
||||
};
|
||||
|
||||
Response.Cookies.Append(
|
||||
CookieRequestCultureProvider.DefaultCookieName,
|
||||
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(value)),
|
||||
cookieOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult Error404() => this.ViewError404();
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using Ganss.Xss;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
@@ -10,14 +9,10 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
public class LocalizationController : ControllerBase
|
||||
{
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
private readonly ILogger<LocalizationController> _logger;
|
||||
private readonly HtmlSanitizer _sanitizer;
|
||||
|
||||
public LocalizationController(IStringLocalizer<Resource> localizer, ILogger<LocalizationController> logger, HtmlSanitizer sanitizer)
|
||||
public LocalizationController(IStringLocalizer<Resource> localizer)
|
||||
{
|
||||
_localizer = localizer;
|
||||
_logger = logger;
|
||||
_sanitizer = sanitizer;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
@@ -38,14 +39,14 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
public async Task<IActionResult> CreateAsync([FromBody] EnvelopeReceiverReadOnlyCreateDto createDto)
|
||||
{
|
||||
//set AddedWho
|
||||
var authReceiverMail = this.GetAuthReceiverMail();
|
||||
var authReceiverMail = User.GetAuthReceiverMail();
|
||||
if (authReceiverMail is null)
|
||||
{
|
||||
_logger.LogError("EmailAddress clam is not found in envelope-receiver-read-only creation process. Create DTO is:\n {dto}", JsonConvert.SerializeObject(createDto));
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
var envelopeId = this.GetAuthEnvelopeId();
|
||||
var envelopeId = User.GetAuthEnvelopeId();
|
||||
if (envelopeId is null)
|
||||
{
|
||||
_logger.LogError("Envelope Id clam is not found in envelope-receiver-read-only creation process. Create DTO is:\n {dto}", JsonConvert.SerializeObject(createDto));
|
||||
|
||||
@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Authentication;
|
||||
using EnvelopeGenerator.Application.Interfaces.Services;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using static EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers;
|
||||
|
||||
@@ -26,7 +27,7 @@ public class TFARegController : ViewControllerBase
|
||||
private readonly TFARegParams _params;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public TFARegController(ILogger<TFARegController> logger, HtmlSanitizer sanitizer, Cultures cultures, IStringLocalizer<Resource> localizer, IEnvelopeReceiverService erService, IAuthenticator authenticator, IReceiverService receiverService, IOptions<TFARegParams> tfaRegParamsOptions) : base(logger, sanitizer, cultures, localizer)
|
||||
public TFARegController(ILogger<TFARegController> logger, Cultures cultures, IStringLocalizer<Resource> localizer, IEnvelopeReceiverService erService, IAuthenticator authenticator, IReceiverService receiverService, IOptions<TFARegParams> tfaRegParamsOptions) : base(logger, cultures, localizer)
|
||||
{
|
||||
_envRcvService = erService;
|
||||
_authenticator = authenticator;
|
||||
@@ -42,12 +43,11 @@ public class TFARegController : ViewControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
envelopeReceiverId = _sanitizer.Sanitize(envelopeReceiverId);
|
||||
(string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId();
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
{
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer[WebKey.WrongEnvelopeReceiverId]);
|
||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer.WrongEnvelopeReceiverId());
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class TFARegController : ViewControllerBase
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, exception: ex, message: _localizer[WebKey.UnexpectedError]);
|
||||
_logger.LogEnvelopeError(envelopeReceiverId: envelopeReceiverId, exception: ex, message: _localizer.WrongEnvelopeReceiverId());
|
||||
return this.ViewInnerServiceError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,12 @@ 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)
|
||||
public ViewControllerBase(ILogger logger, Cultures cultures, IStringLocalizer<Resource> localizer)
|
||||
{
|
||||
_logger = logger;
|
||||
_sanitizer = sanitizer;
|
||||
_cultures = cultures;
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
6
EnvelopeGenerator.Web/Extensions/StringExtensions.cs
Normal file
6
EnvelopeGenerator.Web/Extensions/StringExtensions.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string Format(this string st, params object?[] args) => string.Format(st, args: args);
|
||||
}
|
||||
118
EnvelopeGenerator.Web/Extensions/WebExtensions.cs
Normal file
118
EnvelopeGenerator.Web/Extensions/WebExtensions.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Extensions;
|
||||
|
||||
public static class WebExtensions
|
||||
{
|
||||
#region Auth
|
||||
public static string? GetClaimValue(this ClaimsPrincipal user, string claimType) => user.FindFirstValue(claimType);
|
||||
|
||||
public static string? GetAuthEnvelopeUuid(this ClaimsPrincipal user) => user.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
public static string? GetAuthReceiverSignature(this ClaimsPrincipal user) => user.FindFirstValue(ClaimTypes.Hash);
|
||||
|
||||
public static string? GetAuthReceiverName(this ClaimsPrincipal user) => user.FindFirstValue(ClaimTypes.Name);
|
||||
|
||||
public static string? GetAuthReceiverMail(this ClaimsPrincipal user) => user.FindFirstValue(ClaimTypes.Email);
|
||||
|
||||
public static string? GetAuthEnvelopeTitle(this ClaimsPrincipal user) => user.FindFirstValue(EnvelopeClaimTypes.Title);
|
||||
|
||||
public static int? GetAuthEnvelopeId(this ClaimsPrincipal user)
|
||||
{
|
||||
var env_id_str = user.FindFirstValue(EnvelopeClaimTypes.Id);
|
||||
return int.TryParse(env_id_str, out int env_id) ? env_id : null;
|
||||
}
|
||||
|
||||
public static async Task SignInEnvelopeAsync(this HttpContext context, EnvelopeReceiverDto er, string receiverRole)
|
||||
{
|
||||
var claims = new List<Claim> {
|
||||
new(ClaimTypes.NameIdentifier, er.Envelope!.Uuid),
|
||||
new(ClaimTypes.Hash, er.Receiver!.Signature),
|
||||
new(ClaimTypes.Name, er.Name ?? string.Empty),
|
||||
new(ClaimTypes.Email, er.Receiver.EmailAddress),
|
||||
new(EnvelopeClaimTypes.Title, er.Envelope.Title),
|
||||
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString()),
|
||||
new(ClaimTypes.Role, receiverRole)
|
||||
};
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
AllowRefresh = false,
|
||||
IsPersistent = false
|
||||
};
|
||||
|
||||
await context.SignInAsync(
|
||||
CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Cookie
|
||||
public static string? GetCulture(this IRequestCookieCollection cookies)
|
||||
=> cookies[CookieRequestCultureProvider.DefaultCookieName];
|
||||
|
||||
public static void SetCulture(this IResponseCookies cookies, string culture)
|
||||
{
|
||||
var cookieOptions = new CookieOptions
|
||||
{
|
||||
Secure = false,
|
||||
SameSite = SameSiteMode.Strict,
|
||||
HttpOnly = true
|
||||
};
|
||||
cookies.Append(
|
||||
CookieRequestCultureProvider.DefaultCookieName,
|
||||
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
|
||||
cookieOptions);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region View error
|
||||
//TODO: integrate localizer for ready-to-use views
|
||||
//TODO: integrate to global exception handler middleware
|
||||
public static ViewResult ViewError(this Controller controller, ErrorViewModel errorViewModel) => controller.View("_Error", errorViewModel);
|
||||
|
||||
public static ViewResult ViewError404(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Die von Ihnen gesuchte Seite ist nicht verfügbar",
|
||||
Body = "Sie können derzeit nur an Sie gerichtete Briefe einsehen und unterschreiben.",
|
||||
});
|
||||
|
||||
public static ViewResult ViewEnvelopeNotFound(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Document not found",
|
||||
Body = "Wenn Sie diese URL in Ihrer E-Mail erhalten haben, wenden Sie sich bitte an das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewDocumentNotFound(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "404",
|
||||
Subtitle = "Umschlag nicht gefunden",
|
||||
Body = "Wenn Sie diese URL in Ihrer E-Mail erhalten haben, wenden Sie sich bitte an das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewAccessCodeNotSent(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "500",
|
||||
Subtitle = "Der Zugangscode konnte nicht gesendet werden",
|
||||
Body = "Bitte kontaktieren Sie das IT-Team."
|
||||
});
|
||||
|
||||
public static ViewResult ViewInnerServiceError(this Controller controller) => controller.ViewError(new()
|
||||
{
|
||||
Title = "500",
|
||||
Subtitle = "Ein unerwarteter Fehler ist aufgetreten",
|
||||
Body = "Bitte kontaktieren Sie das IT-Team."
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
34
EnvelopeGenerator.Web/Middleware/CultureMiddleware.cs
Normal file
34
EnvelopeGenerator.Web/Middleware/CultureMiddleware.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using EnvelopeGenerator.Web.Extensions;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Middleware;
|
||||
|
||||
public class CultureMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly Cultures _cultures;
|
||||
|
||||
public CultureMiddleware(RequestDelegate next, IOptions<Cultures> culturesOpt)
|
||||
{
|
||||
_next = next;
|
||||
_cultures = culturesOpt.Value;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
var cookieName = CookieRequestCultureProvider.DefaultCookieName;
|
||||
var cookieValue = context.Request.Cookies[cookieName];
|
||||
|
||||
if (string.IsNullOrEmpty(cookieValue))
|
||||
{
|
||||
context.Response.Cookies.SetCulture(_cultures.Default.Language);
|
||||
CultureInfo.CurrentCulture = new CultureInfo(_cultures.Default.Language);
|
||||
CultureInfo.CurrentUICulture = new CultureInfo(_cultures.Default.Language);
|
||||
}
|
||||
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ try
|
||||
|
||||
//AddEF Core dbcontext
|
||||
var useDbMigration = Environment.GetEnvironmentVariable("MIGRATION_TEST_MODE") == true.ToString() || config.GetValue<bool>("UseDbMigration");
|
||||
var cnnStrName = useDbMigration ? Key.DbMigrationTest : Key.Default;
|
||||
var cnnStrName = useDbMigration ? "DbMigrationTest" : "Default";
|
||||
var connStr = config.GetConnectionString(cnnStrName)
|
||||
?? throw new InvalidOperationException($"Connection string '{cnnStrName}' is missing in the application configuration.");
|
||||
|
||||
@@ -201,6 +201,7 @@ try
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseMiddleware<ExceptionHandlingMiddleware>();
|
||||
app.UseMiddleware<CultureMiddleware>();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace EnvelopeGenerator.Web.Services
|
||||
_logger = logger;
|
||||
|
||||
_logger.LogInformation("Establishing MSSQL Database connection..");
|
||||
MSSQL = new MSSQLServer(logConfig, config.GetConnectionString(Key.Default));
|
||||
MSSQL = new MSSQLServer(logConfig, config.GetConnectionString("Default"));
|
||||
|
||||
if (MSSQL.DBInitialized == true)
|
||||
{
|
||||
|
||||
@@ -33,24 +33,6 @@ public class EnvelopeOldService
|
||||
_configService = configService;
|
||||
}
|
||||
|
||||
public void EnsureValidEnvelopeKey(string envelopeKey)
|
||||
{
|
||||
_logger.LogInformation("Parsing EnvelopeKey..");
|
||||
|
||||
if (string.IsNullOrEmpty(envelopeKey))
|
||||
throw new ArgumentNullException("EnvelopeKey");
|
||||
|
||||
Tuple<string, string> result = Helpers.DecodeEnvelopeReceiverId(envelopeKey);
|
||||
_logger.LogInformation("EnvelopeUUID: [{0}]", result.Item1);
|
||||
_logger.LogInformation("ReceiverSignature: [{0}]", result.Item2);
|
||||
|
||||
if (string.IsNullOrEmpty(result.Item1))
|
||||
throw new ArgumentNullException("EnvelopeUUID");
|
||||
|
||||
if (string.IsNullOrEmpty(result.Item2))
|
||||
throw new ArgumentNullException("ReceiverSignature");
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<EnvelopeReceiver> LoadEnvelope(string pEnvelopeKey)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
|
||||
@using Newtonsoft.Json
|
||||
@using EnvelopeGenerator.Web.Extensions;
|
||||
@model Auth;
|
||||
@{
|
||||
//TODO: Create view model
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var cImg = _cImgOpt.Value;
|
||||
ViewData["Title"] = _localizer[WebKey.DocProtected];
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
ViewData["Title"] = _localizer.DocProtected();
|
||||
string codeType = ViewData["CodeType"] is string _codeType ? _codeType : "accessCode";
|
||||
string codeKeyName = (char.ToUpper(codeType[0]) + codeType.Substring(1)).Replace("Code", "");
|
||||
bool viaSms = codeType == "smsCode";
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="page container py-4 px-4">
|
||||
<header class="text-center">
|
||||
<div class="header-1 alert alert-secondary" role="alert">
|
||||
<h3 class="text">@_localizer[WebKey.WelcomeToTheESignPortal]</h3>
|
||||
<h3 class="text">@_localizer.WelcomeToTheESignPortal()</h3>
|
||||
<img class="@cImg["Company"].GetClassIn("Locked")" src="@cImg["Company"].Src" />
|
||||
</div>
|
||||
<div class="icon locked @(viaTFA ? "tfa" : "") mt-4 mb-1">
|
||||
@@ -32,7 +32,7 @@
|
||||
<path d="M9.5 6.5a1.5 1.5 0 0 1-1 1.415l.385 1.99a.5.5 0 0 1-.491.595h-.788a.5.5 0 0 1-.49-.595l.384-1.99a1.5 1.5 0 1 1 2-1.415" />
|
||||
</svg>
|
||||
</div>
|
||||
<h1>@_localizer[WebKey.Formats.LockedTitle.Format(codeKeyName)]</h1>
|
||||
<h1>@_localizer.LockedTitle(codeKeyName)</h1>
|
||||
</header>
|
||||
@if (viaAuthenticator && (tfaRegDeadline is null || tfaRegDeadline > DateTime.Now))
|
||||
{
|
||||
@@ -48,14 +48,14 @@
|
||||
</section>
|
||||
}
|
||||
<section class="text-center">
|
||||
<p>@_localizer[WebKey.Formats.LockedBody.Format(codeKeyName)].Value</p>
|
||||
<p>@_localizer.LockedBody(codeKeyName)</p>
|
||||
</section>
|
||||
<div class="row m-0 p-0">
|
||||
<div class="access-code-panel justify-content-center align-items-center p-0 m-0">
|
||||
<form id="form-access-code" class="form form-floating mb-0" method="post">
|
||||
<div class="form-floating access-code-form-floating">
|
||||
<input type="password" id="access_code" class="form-control" name="@codeType" placeholder="@_localizer[WebKey.Formats.LockedCodeLabel.Format(codeKeyName)]" required="required">
|
||||
<label for="access_code">@_localizer[WebKey.Formats.LockedCodeLabel.Format(codeKeyName)]</label>
|
||||
<input type="password" id="access_code" class="form-control" name="@codeType" placeholder="@_localizer.LockedCodeLabel(codeKeyName)]" required="required">
|
||||
<label for="access_code">@_localizer.LockedCodeLabel(codeKeyName)</label>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<span class="material-symbols-outlined">
|
||||
login
|
||||
@@ -86,14 +86,13 @@
|
||||
@if (ViewData["ErrorMessage"] is string errMsg)
|
||||
{
|
||||
<div id="access-code-error-message" class="alert alert-danger row" role="alert">
|
||||
@_sanitizer.Sanitize(errMsg)
|
||||
|
||||
@errMsg
|
||||
</div>
|
||||
}
|
||||
<section class="no-receiver-explanation text-center">
|
||||
<details>
|
||||
<summary>@_localizer[WebKey.Formats.LockedFooterTitle.Format(codeKeyName)]</summary>
|
||||
<p>@Html.Raw(_localizer[WebKey.Formats.LockedFooterBody.Format(codeKeyName)].Value.Format(senderEmail, "Envelope - " + envelopeTitle, string.Empty))</p>
|
||||
<summary>@_localizer.LockedFooterTitle(codeKeyName)</summary>
|
||||
<p>@Html.Raw(_localizer.LockedFooterBody(codeKeyName).Format(senderEmail, "Envelope - " + envelopeTitle, string.Empty))</p>
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
@{
|
||||
ViewData["Title"] = _localizer[WebKey.DocRejected];
|
||||
ViewData["Title"] = _localizer.DocRejected();
|
||||
}
|
||||
@{
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
}
|
||||
@using DigitalData.Core.Abstraction.Application.DTO;
|
||||
@using EnvelopeGenerator.Application.Dto.EnvelopeReceiver
|
||||
@using EnvelopeGenerator.Web.Extensions
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Serialization
|
||||
@model EnvelopeReceiverDto;
|
||||
@{
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
var envelope = Model.Envelope;
|
||||
var document = Model.Envelope?.Documents?.FirstOrDefault();
|
||||
var sender = Model.Envelope?.User;
|
||||
@@ -54,16 +54,16 @@
|
||||
c-5.791,5.79-15.176,5.79-20.969,0l-30.32-30.322l-11.676,11.676l30.32,30.32c5.79,5.79,5.79,15.178,0,20.969L299.11,404.045z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h1>@_localizer[isExt ? WebKey.RejectionInfo1_ext : WebKey.RejectionInfo1].TrySanitize(_sanitizer)</h1>
|
||||
<h1>@(isExt ? _localizer.RejectionInfo1Ext() : _localizer.RejectionInfo1())</h1>
|
||||
</header>
|
||||
<section class="text-center">
|
||||
<div class="card-body p-0 m-0 ms-4">
|
||||
<p class="card-text p-0 m-0">
|
||||
<small class="text-body-secondary">
|
||||
@Html.Raw(string.Format(_localizer[isExt ? WebKey.RejectionInfo2_ext : WebKey.RejectionInfo2],
|
||||
$"{sender?.Prename} {sender?.Name}".TrySanitize(_sanitizer),
|
||||
sender?.Email.TrySanitize(_sanitizer),
|
||||
envelope?.Title.TrySanitize(_sanitizer)))
|
||||
@Html.Raw((isExt ? _localizer.RejectionInfo2Ext() : _localizer.RejectionInfo2()).Format(
|
||||
$"{sender?.Prename} {sender?.Name}",
|
||||
sender?.Email,
|
||||
envelope?.Title))
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = _localizer[WebKey.DocSigned];
|
||||
ViewData["Title"] = _localizer.DocSigned();
|
||||
}
|
||||
<div class="page container p-5">
|
||||
<header class="text-center">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="page container py-4 px-4">
|
||||
<header class="text-center">
|
||||
<div class="header-1 alert alert-secondary" role="alert">
|
||||
<h3 class="text">@_localizer[WebKey.WelcomeToTheESignPortal]</h3>
|
||||
<h3 class="text">@_localizer.WelcomeToTheESignPortal()</h3>
|
||||
<img class="@cImg["Company"].GetClassIn("Locked")" src="@cImg["Company"].Src" />
|
||||
</div>
|
||||
<div class="icon mt-4 mb-1">
|
||||
@@ -27,12 +27,12 @@
|
||||
@if (ViewData["ErrorMessage"] is string errMsg)
|
||||
{
|
||||
<div id="access-code-error-message" class="alert alert-danger row" role="alert">
|
||||
@_sanitizer.Sanitize(errMsg)
|
||||
@errMsg
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<script nonce="@nonce">
|
||||
const msg = "@_localizer[WebKey.HomePageDescription]";
|
||||
const msg = "@_localizer.HomePageDescription()";
|
||||
var typed = new Typed('#home-description', {
|
||||
strings: [msg],
|
||||
typeSpeed: 15,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@using EnvelopeGenerator.Application.Dto;
|
||||
@using EnvelopeGenerator.Application.Dto.EnvelopeReceiver
|
||||
@using EnvelopeGenerator.Application.Dto.EnvelopeReceiverReadOnly
|
||||
@using EnvelopeGenerator.Web.Extensions
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Serialization
|
||||
@model EnvelopeReceiverDto;
|
||||
@@ -18,12 +19,12 @@
|
||||
var pages = document?.Elements?.Select(e => e.Page) ?? Array.Empty<int>();
|
||||
int? signatureCount = document?.Elements?.Count();
|
||||
var stPageIndexes = string.Join(pages.Count() > 1 ? ", " : "", pages.Take(pages.Count() - 1))
|
||||
+ (pages.Count() > 1 ? $" {_localizer[WebKey.and].TrySanitize(_sanitizer)} " : "") + pages.LastOrDefault();
|
||||
+ (pages.Count() > 1 ? $" {_localizer.And()} " : "") + pages.LastOrDefault();
|
||||
var isReadOnly = false;
|
||||
if (ViewData["IsReadOnly"] is bool isReadOnly_bool)
|
||||
isReadOnly = isReadOnly_bool;
|
||||
|
||||
ViewData["Title"] = isReadOnly ? _localizer[WebKey.ViewDoc] : _localizer[WebKey.SignDoc];
|
||||
ViewData["Title"] = isReadOnly ? _localizer.ViewDoc() : _localizer.SignDoc();
|
||||
}
|
||||
<div class="envelope-view">
|
||||
@if (!isReadOnly)
|
||||
@@ -34,13 +35,13 @@
|
||||
<path d="m10.036 8.278 9.258-7.79A1.979 1.979 0 0 0 18 0H2A1.987 1.987 0 0 0 .641.541l9.395 7.737Z" />
|
||||
<path d="M11.241 9.817c-.36.275-.801.425-1.255.427-.428 0-.845-.138-1.187-.395L0 2.6V14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2.5l-8.759 7.317Z" />
|
||||
</svg>
|
||||
<span>@_localizer[WebKey.Complete]</span>
|
||||
<span>@_localizer.Complete()</span>
|
||||
</button>
|
||||
<button class="btn_reject btn btn-danger btn-desktop" type="button">
|
||||
<svg width="25px" height="25px" viewBox="43.5 43.5 512 512" version="1.1" fill="currentColor" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<path class="st0" d="M263.24,43.5c-117.36,0-212.5,95.14-212.5,212.5s95.14,212.5,212.5,212.5s212.5-95.14,212.5-212.5 S380.6,43.5,263.24,43.5z M367.83,298.36c17.18,17.18,17.18,45.04,0,62.23v0c-17.18,17.18-45.04,17.18-62.23,0l-42.36-42.36 l-42.36,42.36c-17.18,17.18-45.04,17.18-62.23,0v0c-17.18-17.18-17.18-45.04,0-62.23L201.01,256l-42.36-42.36 c-17.18-17.18-17.18-45.04,0-62.23v0c17.18-17.18,45.04-17.18,62.23,0l42.36,42.36l42.36-42.36c17.18-17.18,45.04-17.18,62.23,0v0 c17.18,17.18,17.18,45.04,0,62.23L325.46,256L367.83,298.36z" />
|
||||
</svg>
|
||||
<span>@_localizer[WebKey.Reject]</span>
|
||||
<span>@_localizer.Reject()</span>
|
||||
</button>
|
||||
<button class="btn_refresh btn btn-secondary btn-desktop" type="button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
|
||||
@@ -68,7 +69,7 @@
|
||||
<div class="logo">
|
||||
<img class="@cImg["Company"].GetClassIn("Show")" src="@cImg["Company"].Src" alt="logo">
|
||||
</div>
|
||||
<h2>@($"{envelope?.Title}".TrySanitize(_sanitizer))</h2>
|
||||
<h2>@($"{envelope?.Title}")</h2>
|
||||
@if (isReadOnly)
|
||||
{
|
||||
var dateTimeSt = string.Empty;
|
||||
@@ -78,18 +79,18 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<h6>@($"{@envelope?.Message}".TrySanitize(_sanitizer))</h6>
|
||||
<h6>@($"{@envelope?.Message}")</h6>
|
||||
}
|
||||
<p>
|
||||
<small class="text-body-secondary">
|
||||
@Html.Raw(string.Format(_localizer[WebKey.EnvelopeInfo2], /* sanitize separately but don't sanitize the URI */
|
||||
envelope?.AddedWhen.ToString(userCulture?.Info?.DateTimeFormat).TrySanitize(_sanitizer),
|
||||
$"{sender?.Prename} {sender?.Name}".TrySanitize(_sanitizer),
|
||||
sender?.Email.TrySanitize(_sanitizer),
|
||||
envelope?.Title.TrySanitize(_sanitizer),
|
||||
sender?.Prename.TrySanitize(_sanitizer),
|
||||
sender?.Name.TrySanitize(_sanitizer),
|
||||
sender?.Email.TrySanitize(_sanitizer)))
|
||||
@Html.Raw(_localizer.EnvelopeInfo2().Format(
|
||||
envelope?.AddedWhen.ToString(userCulture?.Info?.DateTimeFormat),
|
||||
$"{sender?.Prename} {sender?.Name}",
|
||||
sender?.Email,
|
||||
envelope?.Title,
|
||||
sender?.Prename,
|
||||
sender?.Name,
|
||||
sender?.Email))
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
@@ -212,6 +213,6 @@
|
||||
var documentBase64String = Convert.ToBase64String(documentBytes);
|
||||
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"]", "@userCulture?.Info?.TwoLetterISOLanguageName").init())
|
||||
@:document.addEventListener("DOMContentLoaded", async () => await new App("@envelopeKey", @Html.Raw(envelopeReceiverJson), B64ToBuff("@Html.Raw(documentBase64String)"), "@ViewData["PSPDFKitLicenseKey"]", "@userCulture?.Info?.TwoLetterISOLanguageName").init())
|
||||
}
|
||||
</script>
|
||||
@@ -3,9 +3,6 @@
|
||||
@using Newtonsoft.Json.Serialization
|
||||
@{
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
//TODO: instead of default assignment add a middleware for culture
|
||||
userCulture ??= _cultures.Default;
|
||||
var isReadOnly = false;
|
||||
if (ViewData["IsReadOnly"] is bool isReadOnly_bool)
|
||||
isReadOnly = isReadOnly_bool;
|
||||
@@ -38,10 +35,9 @@
|
||||
<script nonce="@nonce">
|
||||
@if (ViewData["EnvelopeKey"] is string envelopeKey)
|
||||
{
|
||||
@: const ENV_KEY = "@envelopeKey.TrySanitize(_sanitizer)"
|
||||
@: const ENV_KEY = "@envelopeKey";
|
||||
}
|
||||
const IS_READONLY = @isReadOnly.ToString().ToLower();
|
||||
|
||||
const DEVICE_SCREEN_TYPE = window.innerWidth <= 768 ? 'mobile' : window.innerWidth <= 1024 ? 'tablet' : 'desktop';
|
||||
|
||||
const IS_DESKTOP_SIZE = DEVICE_SCREEN_TYPE == 'desktop'
|
||||
@@ -83,7 +79,7 @@
|
||||
<span>© SignFlow 2023-2024 <a href="https://digitaldata.works" target="_blank">Digital Data GmbH</a></span>
|
||||
<div class="dropup flag-dropdown">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="langDropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="fi @userCulture?.FIClass.TrySanitize(_sanitizer) me-2" id="selectedFlag"></span><span id="selectedLanguage"></span>
|
||||
<span class="fi @_localizer.FiClass() me-2" id="selectedFlag"></span><span id="selectedLanguage"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="langDropdownMenuButton">
|
||||
@foreach (var culture in _cultures)
|
||||
@@ -91,14 +87,14 @@
|
||||
var lang = culture.Language;
|
||||
var info = culture.Info;
|
||||
<li>
|
||||
<a class="dropdown-item culture-dropdown-item" data-language="@lang.TrySanitize(_sanitizer)" data-flag="@_cultures[lang]?.FIClass.TrySanitize(_sanitizer)">
|
||||
<span class="fi @_cultures[lang]?.FIClass.TrySanitize(_sanitizer) me-2"></span>@info?.Parent.NativeName
|
||||
<a class="dropdown-item culture-dropdown-item" data-language="@lang" data-flag="@_cultures[lang]?.FIClass">
|
||||
<span class="fi @_cultures[lang]?.FIClass me-2"></span>@info?.Parent.NativeName
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<a href="/privacy-policy.@(userCulture?.Language).html" target="_blank">@_localizer[WebKey.Privacy]</a>
|
||||
<a href="/privacy-policy.@(_localizer.Culture()).html" target="_blank">@_localizer.Privacy()</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -32,7 +32,7 @@
|
||||
<section>
|
||||
<article class="envelope">
|
||||
<strong><a href="/EnvelopeKey/@encodeEnvelopeKey(envelope)">@envelope.Title</a></strong>
|
||||
<div><strong>Ersteller</strong> @envelope.User.Email.TrySanitize(_sanitizer)</div>
|
||||
<div><strong>Ersteller</strong> @envelope.User.Email</div>
|
||||
<div><strong>Datum</strong> @envelope.AddedWhen</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
@using EnvelopeGenerator.Application.Resources
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject IStringLocalizer<Resource> _localizer
|
||||
@inject System.Text.Encodings.Web.UrlEncoder _encoder
|
||||
@inject Ganss.Xss.HtmlSanitizer _sanitizer
|
||||
@inject HighlightHtmlSanitizer _hlSanitizer
|
||||
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor _accessor
|
||||
@inject Cultures _cultures
|
||||
@inject IOptions<CustomImages> _cImgOpt
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
namespace EnvelopeGenerator.Web
|
||||
{
|
||||
public static class WebKey
|
||||
{
|
||||
public static readonly string ServiceOutputNullError = nameof(ServiceOutputNullError);
|
||||
public static readonly string UnexpectedError = nameof(UnexpectedError);
|
||||
public static readonly string FailedToSendAccessCode = nameof(FailedToSendAccessCode);
|
||||
public static readonly string WrongEnvelopeReceiverId = nameof(WrongEnvelopeReceiverId);
|
||||
public static readonly string DataIntegrityError = nameof(DataIntegrityError);
|
||||
public static readonly string NonDecodableEnvelopeReceiverId = nameof(NonDecodableEnvelopeReceiverId);
|
||||
public static readonly string de_DE = nameof(de_DE).Replace("_", "-");
|
||||
public static readonly string en_US = nameof(en_US).Replace("_", "-");
|
||||
public static readonly string WrongAccessCode = nameof(WrongAccessCode);
|
||||
public static readonly string SignDoc = nameof(SignDoc);
|
||||
public static readonly string DocRejected = nameof(DocRejected);
|
||||
public static readonly string DocSigned = nameof(DocSigned);
|
||||
public static readonly string DocProtected = nameof(DocProtected);
|
||||
public static readonly string Complete = nameof(Complete);
|
||||
public static readonly string EnvelopeInfo1 = nameof(EnvelopeInfo1);
|
||||
public static readonly string EnvelopeInfo2 = nameof(EnvelopeInfo2);
|
||||
public static readonly string SigAgree = nameof(SigAgree);
|
||||
public static readonly string Reject = nameof(Reject);
|
||||
public static readonly string and = nameof(and);
|
||||
public static readonly string Hello = nameof(Hello);
|
||||
public static readonly string RejectionInfo1 = nameof(RejectionInfo1);
|
||||
public static readonly string RejectionInfo2 = nameof(RejectionInfo2);
|
||||
public static readonly string RejectionInfo1_ext = nameof(RejectionInfo1_ext);
|
||||
public static readonly string RejectionInfo2_ext = nameof(RejectionInfo2_ext);
|
||||
public static readonly string SigningProcessTitle = nameof(SigningProcessTitle);
|
||||
public static readonly string WelcomeToTheESignPortal = nameof(WelcomeToTheESignPortal);
|
||||
public static readonly string ViewDoc = nameof(ViewDoc);
|
||||
public static readonly string HomePageDescription = nameof(HomePageDescription);
|
||||
public static readonly string Privacy = nameof(Privacy);
|
||||
|
||||
public static class Formats
|
||||
{
|
||||
public static readonly string LockedTitle = nameof(LockedTitle) + "{0}";
|
||||
|
||||
public static readonly string LockedBody = nameof(LockedBody) + "{0}";
|
||||
|
||||
public static readonly string LockedCodeLabel = nameof(LockedCodeLabel) + "{0}";
|
||||
|
||||
public static readonly string LockedFooterTitle = nameof(LockedFooterTitle) + "{0}";
|
||||
|
||||
public static readonly string LockedFooterBody = nameof(LockedFooterBody) + "{0}";
|
||||
}
|
||||
|
||||
public static string Format(this string st, object? arg0) => string.Format(st, arg0: arg0);
|
||||
|
||||
public static string Format(this string st, params object?[] args) => string.Format(st, args: args);
|
||||
}
|
||||
}
|
||||
@@ -71,17 +71,8 @@ class App {
|
||||
try {
|
||||
this.signatureCount = this.currentDocument.elements.length
|
||||
await createAnnotations(this.currentDocument, this.Instance)
|
||||
|
||||
const openResponse = await this.Network.openDocument(this.envelopeKey)
|
||||
|
||||
if (openResponse.fatal || openResponse.error) {
|
||||
return Swal.fire({
|
||||
title: 'Fehler',
|
||||
text: 'Umschlag konnte nicht geöffnet werden!',
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error loading annotations:", e);
|
||||
}
|
||||
|
||||
//add click events of external buttons
|
||||
|
||||
@@ -30,15 +30,6 @@
|
||||
.then(this.wrapBinaryResponse.bind(this))
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the server that document has been seen
|
||||
* @param {any} envelopeKey
|
||||
*/
|
||||
async openDocument(envelopeKey) {
|
||||
return this.postRequest(`/api/document/${envelopeKey}`, {})
|
||||
.then(this.wrapJsonResponse.bind(this))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add CSRF Token to request headers
|
||||
* @param {any} options
|
||||
|
||||
Reference in New Issue
Block a user