diff --git a/EnvelopeGenerator.Application/Resources/Resource.cs b/EnvelopeGenerator.Application/Resources/Resource.cs
index d8b51c1b..56b087c3 100644
--- a/EnvelopeGenerator.Application/Resources/Resource.cs
+++ b/EnvelopeGenerator.Application/Resources/Resource.cs
@@ -21,117 +21,346 @@ public static class Extensions
///
///
///
- public static string InnerServiceError(this IStringLocalizer localizer) => localizer[nameof(InnerServiceError)];
+ public static string InnerServiceError(this IStringLocalizer localizer) => localizer[nameof(InnerServiceError)].Value;
///
///
///
///
///
- public static string EnvelopeNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeNotFound)];
+ public static string EnvelopeNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeNotFound)].Value;
///
///
///
///
///
- public static string EnvelopeReceiverNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeReceiverNotFound)];
+ public static string EnvelopeReceiverNotFound(this IStringLocalizer localizer) => localizer[nameof(EnvelopeReceiverNotFound)].Value;
///
///
///
///
///
- public static string AccessCodeNull(this IStringLocalizer localizer) => localizer[nameof(AccessCodeNull)];
+ public static string AccessCodeNull(this IStringLocalizer localizer) => localizer[nameof(AccessCodeNull)].Value;
///
///
///
///
///
- public static string WrongAccessCode(this IStringLocalizer localizer) => localizer[nameof(WrongAccessCode)];
+ public static string WrongAccessCode(this IStringLocalizer localizer) => localizer[nameof(WrongAccessCode)].Value;
///
///
///
///
///
- public static string DataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(DataIntegrityIssue)];
+ public static string DataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(DataIntegrityIssue)].Value;
///
///
///
///
///
- public static string SecurityBreachOrDataIntegrity(this IStringLocalizer localizer) => localizer[nameof(SecurityBreachOrDataIntegrity)];
+ public static string SecurityBreachOrDataIntegrity(this IStringLocalizer localizer) => localizer[nameof(SecurityBreachOrDataIntegrity)].Value;
///
///
///
///
///
- public static string PossibleDataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(PossibleDataIntegrityIssue)];
+ public static string PossibleDataIntegrityIssue(this IStringLocalizer localizer) => localizer[nameof(PossibleDataIntegrityIssue)].Value;
///
///
///
///
///
- public static string SecurityBreach(this IStringLocalizer localizer) => localizer[nameof(SecurityBreach)];
+ public static string SecurityBreach(this IStringLocalizer localizer) => localizer[nameof(SecurityBreach)].Value;
///
///
///
///
///
- public static string PossibleSecurityBreach(this IStringLocalizer localizer) => localizer[nameof(PossibleSecurityBreach)];
+ public static string PossibleSecurityBreach(this IStringLocalizer localizer) => localizer[nameof(PossibleSecurityBreach)].Value;
///
///
///
///
///
- public static string WrongEnvelopeReceiverId(this IStringLocalizer localizer) => localizer[nameof(WrongEnvelopeReceiverId)];
+ public static string WrongEnvelopeReceiverId(this IStringLocalizer localizer) => localizer[nameof(WrongEnvelopeReceiverId)].Value;
///
///
///
///
///
- public static string EnvelopeOrReceiverNonexists(this IStringLocalizer localizer) => localizer[nameof(EnvelopeOrReceiverNonexists)];
+ public static string EnvelopeOrReceiverNonexists(this IStringLocalizer localizer) => localizer[nameof(EnvelopeOrReceiverNonexists)].Value;
///
///
///
///
///
- public static string PhoneNumberNonexists(this IStringLocalizer localizer) => localizer[nameof(PhoneNumberNonexists)];
+ public static string PhoneNumberNonexists(this IStringLocalizer localizer) => localizer[nameof(PhoneNumberNonexists)].Value;
///
///
///
///
///
- public static string Default(this IStringLocalizer localizer) => localizer[nameof(Default)];
+ public static string Default(this IStringLocalizer localizer) => localizer[nameof(Default)].Value;
///
///
///
///
///
- public static string DbMigrationTest(this IStringLocalizer localizer) => localizer[nameof(DbMigrationTest)];
+ public static string DbMigrationTest(this IStringLocalizer localizer) => localizer[nameof(DbMigrationTest)].Value;
///
///
///
///
///
- public static string Culture(this IStringLocalizer localizer) => localizer[nameof(Culture)];
+ public static string Culture(this IStringLocalizer localizer) => localizer[nameof(Culture)].Value;
///
///
///
///
///
- public static string FiClass(this IStringLocalizer localizer) => localizer[nameof(FiClass)];
+ public static string FiClass(this IStringLocalizer localizer) => localizer[nameof(FiClass)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string ServiceOutputNullError(this IStringLocalizer localizer) => localizer[nameof(ServiceOutputNullError)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string UnexpectedError(this IStringLocalizer localizer) => localizer[nameof(UnexpectedError)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string FailedToSendAccessCode(this IStringLocalizer localizer) => localizer[nameof(FailedToSendAccessCode)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string DataIntegrityError(this IStringLocalizer localizer) => localizer[nameof(DataIntegrityError)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string NonDecodableEnvelopeReceiverId(this IStringLocalizer localizer) => localizer[nameof(NonDecodableEnvelopeReceiverId)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string DeDE(this IStringLocalizer localizer) => localizer["de-DE"].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string EnUS(this IStringLocalizer localizer) => localizer["en-US"].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string SignDoc(this IStringLocalizer localizer) => localizer[nameof(SignDoc)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string DocRejected(this IStringLocalizer localizer) => localizer[nameof(DocRejected)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string DocSigned(this IStringLocalizer localizer) => localizer[nameof(DocSigned)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string DocProtected(this IStringLocalizer localizer) => localizer[nameof(DocProtected)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string Complete(this IStringLocalizer localizer) => localizer[nameof(Complete)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string EnvelopeInfo1(this IStringLocalizer localizer) => localizer[nameof(EnvelopeInfo1)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string EnvelopeInfo2(this IStringLocalizer localizer) => localizer[nameof(EnvelopeInfo2)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string SigAgree(this IStringLocalizer localizer) => localizer[nameof(SigAgree)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string Reject(this IStringLocalizer localizer) => localizer[nameof(Reject)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string And(this IStringLocalizer localizer) => localizer["and"].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string Hello(this IStringLocalizer localizer) => localizer[nameof(Hello)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string RejectionInfo1(this IStringLocalizer localizer) => localizer[nameof(RejectionInfo1)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string RejectionInfo2(this IStringLocalizer localizer) => localizer[nameof(RejectionInfo2)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string RejectionInfo1Ext(this IStringLocalizer localizer) => localizer["RejectionInfo1_ext"].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string RejectionInfo2Ext(this IStringLocalizer localizer) => localizer["RejectionInfo2_ext"].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string SigningProcessTitle(this IStringLocalizer localizer) => localizer[nameof(SigningProcessTitle)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string WelcomeToTheESignPortal(this IStringLocalizer localizer) => localizer[nameof(WelcomeToTheESignPortal)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string ViewDoc(this IStringLocalizer localizer) => localizer[nameof(ViewDoc)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string HomePageDescription(this IStringLocalizer localizer) => localizer[nameof(HomePageDescription)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string Privacy(this IStringLocalizer localizer) => localizer[nameof(Privacy)].Value;
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string LockedTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(Privacy)].Value, arg0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string LockedBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedBody)].Value, arg0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string LockedCodeLabel(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedCodeLabel)].Value, arg0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string LockedFooterTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterTitle)].Value, arg0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string LockedFooterBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterBody)].Value, arg0);
}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs
index 8f6612d7..eb0e1d1b 100644
--- a/EnvelopeGenerator.Web/Controllers/HomeController.cs
+++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs
@@ -103,7 +103,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();
}
}
@@ -150,7 +150,7 @@ public class HomeController : ViewControllerBase
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();
}
@@ -239,7 +239,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);
@@ -271,7 +271,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);
}
@@ -287,7 +287,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);
}
@@ -306,7 +306,7 @@ public class HomeController : ViewControllerBase
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();
}
@@ -353,7 +353,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);
diff --git a/EnvelopeGenerator.Web/Controllers/TFARegController.cs b/EnvelopeGenerator.Web/Controllers/TFARegController.cs
index 8a49024e..9f1f17ce 100644
--- a/EnvelopeGenerator.Web/Controllers/TFARegController.cs
+++ b/EnvelopeGenerator.Web/Controllers/TFARegController.cs
@@ -46,7 +46,7 @@ public class TFARegController : ViewControllerBase
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();
}
@@ -86,7 +86,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();
}
}
diff --git a/EnvelopeGenerator.Web/StringExtensions.cs b/EnvelopeGenerator.Web/StringExtensions.cs
new file mode 100644
index 00000000..a455a8ce
--- /dev/null
+++ b/EnvelopeGenerator.Web/StringExtensions.cs
@@ -0,0 +1,6 @@
+namespace EnvelopeGenerator.Web;
+
+public static class StringExtensions
+{
+ public static string Format(this string st, params object?[] args) => string.Format(st, args: args);
+}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml
index c182dce6..eb60e695 100644
--- a/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml
+++ b/EnvelopeGenerator.Web/Views/Home/EnvelopeLocked.cshtml
@@ -5,7 +5,7 @@
//TODO: Create view model
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
var cImg = _cImgOpt.Value;
- ViewData["Title"] = _localizer[WebKey.DocProtected];
+ 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";
@@ -22,7 +22,7 @@
- @_localizer[WebKey.Formats.LockedTitle.Format(codeKeyName)]
+ @_localizer.LockedTitle(codeKeyName)
@if (viaAuthenticator && (tfaRegDeadline is null || tfaRegDeadline > DateTime.Now))
{
@@ -47,14 +47,14 @@
}
- @_localizer[WebKey.Formats.LockedBody.Format(codeKeyName)].Value
+ @_localizer.LockedBody(codeKeyName)
-
@_localizer[isExt ? WebKey.RejectionInfo1_ext : WebKey.RejectionInfo1].TrySanitize(_sanitizer)
+
@(isExt ? _localizer.RejectionInfo1Ext() : _localizer.RejectionInfo1())
- @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))
diff --git a/EnvelopeGenerator.Web/Views/Home/EnvelopeSigned.cshtml b/EnvelopeGenerator.Web/Views/Home/EnvelopeSigned.cshtml
index 67cd10ff..fa3a4116 100644
--- a/EnvelopeGenerator.Web/Views/Home/EnvelopeSigned.cshtml
+++ b/EnvelopeGenerator.Web/Views/Home/EnvelopeSigned.cshtml
@@ -1,5 +1,5 @@
@{
- ViewData["Title"] = _localizer[WebKey.DocSigned];
+ ViewData["Title"] = _localizer.DocSigned();
}
diff --git a/EnvelopeGenerator.Web/Views/Home/Main.cshtml b/EnvelopeGenerator.Web/Views/Home/Main.cshtml
index 801ecb7f..b581c65a 100644
--- a/EnvelopeGenerator.Web/Views/Home/Main.cshtml
+++ b/EnvelopeGenerator.Web/Views/Home/Main.cshtml
@@ -8,7 +8,7 @@
@@ -27,12 +27,12 @@
@if (ViewData["ErrorMessage"] is string errMsg)
{
- @_sanitizer.Sanitize(errMsg)
+ @errMsg
}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml
index ce954b26..bbbb1340 100644
--- a/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml
+++ b/EnvelopeGenerator.Web/Views/Shared/_Layout.cshtml
@@ -35,10 +35,9 @@