Compare commits

...

28 Commits

Author SHA1 Message Date
e13413c7fc Enhance access code guidance and resend functionality
Added new localized strings for improved user guidance in `Resource.*.resx` files, including instructions and messages for resending access codes. Updated `LoginReceiverPage.razor` to include detailed UI elements for access code guidance, such as step-by-step instructions and a resend button with dynamic feedback.

Introduced new state variables (`IsResending`, `ResendRequestFailed`, `ResendResult`) and implemented the `ResendAccessCodeAsync` method to handle resend logic. Modified `AuthService.RequestEnvelopeReceiverAccessCodeAsync` to support an `autoGenerated` flag, enabling differentiation between automatic and manual access code requests.

These changes improve the user experience by providing clearer instructions and a streamlined process for resending access codes.
2026-11-16 13:41:50 +01:00
6c9b8ad3a8 Limit repeated access code requests via caching
Introduced a mechanism to limit repeated access code requests
within a configurable time period using `IMemoryCache` and a
new `RepeatRequestBlockingPeriod` configuration in
`SendAccessCodeParams`.

Key changes:
- Added `SendAccessCodeParams` configuration to `appsettings.json`.
- Updated DI in `DependencyInjection.cs` to include `SendAccessCodeParams`.
- Enhanced `SendAccessCodeCommand` with `MultipleRequestsAllowed`.
- Updated `SendAccessCodeCommandHandler` to handle caching logic:
  - Added `IsAccessCodeRequestsDisabled` and `DisableAccessCodeRequests`.
- Modified `AuthController` to support `autoGenerated` query parameter.
- Improved error handling and documentation.

These changes ensure better control over access code requests
and prevent abuse by limiting repeated requests within a
configurable time window.
2026-11-16 13:11:31 +01:00
93d9aa0742 Handle already signed envelopes in LoginReceiverPage
Updated the `OnInitializedAsync` method in `LoginReceiverPage.razor` to handle cases where the envelope has already been signed. The method now checks the result of `RequestEnvelopeReceiverAccessCodeAsync` and redirects the user to the `/envelope/signed-result` page if the result is `SendAccessCodeResult.AlreadySigned`.
2026-11-16 11:18:54 +01:00
fd2b21a73c Refactor access code request logic with MediatR
Encapsulated the access code request logic in a new `SendAccessCodeCommand` using MediatR. Introduced a `SendAccessCodeResult` enum to standardize outcomes. Refactored `AuthController` to delegate access code handling to the command, simplifying the controller and reducing dependencies.

Updated `AuthService` to map HTTP responses to `SendAccessCodeResult`. Improved error handling and edge case management in `SendAccessCodeCommandHandler`. Centralized history recording and notification logic in the command handler for better maintainability and separation of concerns.
2026-11-16 11:18:14 +01:00
deae4d2acc refactor(notification): derive shared-document links from origin and read-only id
Update DocumentSharedNotification to mirror DocumentReceivedNotification URL strategy.

Replace externally supplied link strings with init-only Origin and ReadOnlyId inputs and compute LINK_TO_DOCUMENT / LINK_TO_DOCUMENT_TEXT internally via ToEnvelopeKey().
2026-11-16 09:16:27 +01:00
55140846ba feat(notification): add typed payloads for non-link email templates
Add strongly typed notification records for remaining email templates that do not require document URL composition.

Each record maps template placeholders to explicit properties and returns the matching EmailTemplateType.

Also includes XML documentation so placeholder-to-property mapping is self-describing.
2026-11-16 09:16:22 +01:00
9c2de46253 Improve dropdown handling and accessibility
Added `id` and `name` attributes to `<select>` elements in `CreateEnvelopeWizardPopup.razor` and `SenderEditorPage.razor` for better accessibility. Replaced hardcoded dropdown values with `FinalEmailType` enum for maintainability.

Introduced `@bind:after` event handlers to track user overrides for `FinalEmailToCreator` and `FinalEmailToReceivers`. Added flags `_finalEmailToCreatorUserOverridden` and `_finalEmailToReceiversUserOverridden` to ensure user changes are respected.

Refactored default value logic into `ApplyEnvelopeTypeFinalEmailDefaults` and updated `NormalizeSettings` to reset override flags. Improved code readability by replacing magic numbers with named constants.
2026-11-13 13:56:04 +01:00
fa56f2059a Refactor enum initialization for type safety
Updated `_finalEmailToCreator` and `_finalEmailToReceivers` in `SenderEditorPage.razor` to use `FinalEmailType.No` directly instead of casting to `(int)`. This improves code readability and ensures type safety by eliminating unnecessary type casting.
2026-11-13 13:39:28 +01:00
bb5175347c Refactor: Use FinalEmailType enum for email settings
Replaced raw `int` values with the strongly-typed `FinalEmailType`
enum for `FinalEmailToCreator` and `FinalEmailToReceivers` across
the codebase. Updated DTOs, entities, commands, handlers, Razor
components, and test controllers to reflect this change.

This improves type safety, code readability, and maintainability.
Default values now use `FinalEmailType.No` instead of integer
casting. Adjusted database mappings and added necessary imports
to support the new enum type.
2026-11-13 13:14:52 +01:00
85033ce667 Remove 20250701151754_InitialCreate migration
This commit removes all code related to the `20250701151754_InitialCreate` migration, including:
- The designer file (`20250701151754_InitialCreate.Designer.cs`)
- The migration implementation file (`20250701151754_InitialCreate.cs`)
- The snapshot file (`EGDbContextModelSnapshot.cs`)

These files contained schema definitions and logic for creating database tables, relationships, and constraints for entities such as `EmailOut`, `ClientUser`, `Group`, `User`, `Envelope`, `Receiver`, and others.

The removal indicates that the migration and its schema definitions are no longer needed or have been deprecated in favor of a different approach to managing the database schema.
2026-11-13 13:00:57 +01:00
c8bd2a348d Refactor envelope type selection logic
Simplified the `<select>` element by replacing `value` and `@onchange` with `@bind` for two-way data binding. Updated `OnEnvelopeTypeChanged` to remove the `ChangeEventArgs` parameter and directly use `_selectedEnvelopeType`. Removed redundant parsing logic and ensured defaults are applied only when `_selectedEnvelopeType` is not null. Cleaned up unnecessary code for better readability and maintainability.
2026-11-13 13:00:40 +01:00
b5c9c8da6c Add framework-specific handling for Id property
Introduce conditional compilation to differentiate `Id` property
behavior between `NET` and `NETFRAMEWORK` environments. For `NET`,
the `Id` property is of type `EnvelopeType` with `[Key]` and
`[Column("GUID")]` attributes. For `NETFRAMEWORK`, the `Id` property
is of type `int` with a default value of `0`, retaining `[Key]`,
`[DatabaseGenerated(DatabaseGeneratedOption.Identity)]`, and
`[Column("GUID")]` attributes. These changes ensure compatibility
and proper configuration across frameworks.
2026-11-13 13:00:10 +01:00
abd3c23f8c Refactor EnvelopeType handling and introduce caching
Updated `EnvelopeDto` to use `EnvelopeTypeDefaultsDto` for the `Defaults` property, decoupling domain entities from external layers.

Refactored `IEnvelopeTypeRepository`, `IEnvelopeTypeService`, and `EnvelopeTypeService` to use `EnvelopeType` as the identifier type instead of `int`, improving domain specificity and consistency.

Introduced caching in `EnvelopeTypeService` with a static `CacheKey` and `IMemoryCache` dependency for performance optimization.

Aligned `EnvelopeTypeRepository` with the updated identifier type and repository interface.
2026-11-13 12:59:48 +01:00
9d4806bef7 Add new properties and remove unused LinkToDocument
Updated ReplacePlaceholderExtensionsTests to include new
properties `EnvelopeUuid`, `Origin`, and `ReceiverSignature`
to enhance functionality. Removed the unused `LinkToDocument`
property. Adjusted `NamePortal` formatting for consistency.
2026-11-13 12:00:46 +01:00
48b2fc0eca Refactor: Replace EnvelopeTypeId with EnvelopeType enum
Replaced all instances of `EnvelopeTypeId` (int/int?) with `Type`
(EnvelopeType/EnvelopeType?) across the codebase to improve type
safety and readability. Updated affected properties, methods, and
logic in DTOs, commands, handlers, and Razor components.

Introduced conditional compilation to handle differences between
.NET and .NET Framework where necessary. Removed obsolete helper
methods for `EnvelopeTypeId`. This refactor ensures consistent use
of the strongly-typed `EnvelopeType` enum, reducing the risk of
invalid values and aligning with best practices.
2026-11-13 11:46:56 +01:00
18fbc2100f Remove ContractType and CertificationType properties
Removed the `ContractType` and `CertificationType` properties
from the `EnvelopeClientDto` class in `EnvelopeReceiverDto.cs`
as they are no longer needed. Updated the `Extensions` class
in `Fake.cs` to remove references to these properties,
including their initialization logic.
2026-11-13 11:09:25 +01:00
13784cd595 Refactor: Remove CertificationType and ContractType
Removed `CertificationType` and `ContractType` properties and logic across the codebase as they were redundant. Updated `EnvelopeType` to include a validation extension method for improved data integrity. Refactored `CreateEnvelopeWizardPopup.razor` and other UI components to simplify handling of `EnvelopeType`.

Conditionally included `CertificationType` and `ContractType` for `NETFRAMEWORK` targets using `#if NETFRAMEWORK` directives to ensure compatibility. Removed unused enums, imports, and methods. Updated `CreateEnvelopeCommandHandler` and related classes to reflect these changes.
2026-11-13 11:06:12 +01:00
67e435c3fa Add envelope type handling and validation methods
Introduced new extension methods for the `IEnvelope` interface:
- Added `Type` method to retrieve and validate `EnvelopeTypeId`, throwing a `DataIntegrityException` for invalid values.
- Added `SetType` method to set the `EnvelopeTypeId` based on a given `EnvelopeType`.
- Added `WithType` method to enable setting `EnvelopeTypeId` with method chaining.

Included conditional compilation for .NET Framework compatibility and added necessary `using` directives for constants and exceptions.
2026-11-13 09:53:21 +01:00
3c80bc4d26 Add EnvelopeType enum to define envelope types
A new namespace `EnvelopeGenerator.Domain.Constants` was added, containing the `EnvelopeType` enumeration. This enum introduces three values: `SimpleSignature` (1), `ReadAndConfirm` (2), and `AdvancedSignature` (3), to represent different envelope types.
2026-11-12 17:05:18 +01:00
22895e259a Rename EnvelopeType to Defaults in EnvelopeDto
Updated the `EnvelopeDto` class to rename the `EnvelopeType` property to `Defaults` for better clarity. Updated all references to `EnvelopeType` in `SenderEditorPage.razor` to use the new `Defaults` property. This includes updates to properties such as `_sendReminderEmails`, `_firstReminderDays`, `_reminderIntervalDays`, `_expiresWhenDays`, and `_expiresWarningWhenDays`. Ensured consistent usage of the renamed property across the application.
2026-11-12 17:04:07 +01:00
f4d2b65943 Refactor Envelope.Type to Envelope.Defaults
Replaced all references to `Envelope.Type` with `Envelope.Defaults` across the application for consistency and clarity.

- Updated `MappingProfile` to map `Defaults.Title` instead of `Type.Title` for `EnvelopeTypeTitle`.
- Modified `ReadEnvelopeQueryHandler` to use `Defaults` in place of `Type` and updated query includes.
- Renamed `Type` to `Defaults` in the `Envelope` entity while preserving its foreign key relationship.
- Updated `EnvelopeModel` to retrieve `Defaults` using `EnvelopeTypeModel.GetById`.
- Refactored `frmEnvelopeMainData` to replace all `Type` references with `Defaults` and adjusted logic for `ContractType` and `EnvelopeType`.

These changes ensure consistent naming and improve code readability.
2026-11-12 16:57:50 +01:00
17da3ea91e Refactor EnvelopeTypeDto to EnvelopeTypeDefaultsDto
Renamed `EnvelopeTypeDto` to `EnvelopeTypeDefaultsDto` to better reflect its purpose as a DTO for default envelope type configurations.

Updated all references to `EnvelopeTypeDto` across the application, including:
- Service interfaces (`IEnvelopeTypeService`) and implementations.
- AutoMapper mappings in `MappingProfile.cs`.
- Query handlers (`ReadEnvelopeTypesQuery` and `ReadEnvelopeTypesQueryHandler`).
- Razor components (`CreateEnvelopeWizardPopup.razor`, `SenderEditorPage.razor`, `SenderPage.razor`).
- Client-side services (`EnvelopeTypeService`).
- Controller (`TestEnvelopeTypeController`).

These changes ensure consistency and clarity in naming conventions while maintaining functionality.
2026-11-12 16:51:34 +01:00
621f9333a4 Refactor: Replace EnvelopeType with EnvelopeTypeDefaults
Replaced the `EnvelopeType` class with `EnvelopeTypeDefaults` across the codebase to standardize the data model. Updated DTOs, repositories, services, mappings, and database contexts to reflect this change.

Key updates include:
- Updated `EnvelopeDto` to use `EnvelopeTypeDefaults`.
- Modified `IEnvelopeTypeRepository` and `IEnvelopeTypeService` interfaces.
- Adjusted mappings in `MappingProfile.cs` for `EnvelopeTypeDefaults`.
- Updated `ReadEnvelopeTypesQueryHandler` and `CreateEnvelopeCommandHandler` to use `EnvelopeTypeDefaults`.
- Replaced `EnvelopeType` with `EnvelopeTypeDefaults` in `EnvelopeTypeModel.vb`, `frmEnvelopeMainData.vb`, and `EGDbContextBase`.
- Introduced the `EnvelopeTypeDefaults` class with updated schema mappings.
- Updated `EnvelopeTypeRepository` and `TestEnvelopeTypeController` to use `EnvelopeTypeDefaults`.

These changes ensure consistency and improve maintainability across the application.
2026-11-12 16:42:27 +01:00
34b184b057 Remove "Certification Type" field from envelope wizard
The "Certification Type" field, including its label, tooltip, and dropdown options, has been removed from the form grid in `CreateEnvelopeWizardPopup.razor`. The associated `OnCertificationTypeChanged` method, which handled changes to this field, was also removed. The form layout was adjusted to reflect the removal of this field, simplifying the structure.
2026-11-12 14:16:55 +01:00
c77beb88df Simplify password input field styling
Refactored the styling of the password input field and its
associated elements:
- Removed `border-end-0` class from the `<span>` element.
- Updated `<input>` to rely on `@GetPasswordInputClass()`
  and removed `border-start-0 border-end-0` classes.
- Adjusted `<button>` styling by removing `border-start-0`
  and using `margin-left: 0;` instead of `border-left: none`.

These changes improve maintainability and ensure consistent
UI styling.
2026-11-12 13:44:28 +01:00
35b6093169 Update footer to dynamically display current year
Replaced the hardcoded copyright year range "2023-2024" in the
footer of `MainLayout.razor` with `@DateTime.Now.Year`. This
ensures the displayed year is always current without requiring
manual updates.
2026-11-12 12:24:01 +01:00
23f2056421 Redesign login page with improved UX and branding
Refactored `LoginSenderPage.razor` to introduce a modern layout, dynamic branding support, and enhanced validation. Updated localization files (`de-DE`, `en-US`, `fr-FR`) with new keys for improved messaging. Added client-side validation for required fields and error handling for invalid credentials.

Enabled anonymous access to `CustomImagesController` for displaying branding before authentication. Updated CSS for consistent theming and responsive design. Cleaned up redundant code and improved maintainability. Footer now dynamically displays the current year and company name.
2026-11-12 11:57:00 +01:00
2b580f5e3d Bump version to 1.9.0-beta
Updated the project version, file version, and assembly version:
- Project version updated from 1.8.0-beta to 1.9.0-beta.
- File version updated from 1.8.0.0 to 1.9.0.0.
- Assembly version updated from 1.8.0.0 to 1.9.0.0.

This version increment likely includes new features, improvements, or other updates to the `EnvelopeGenerator.Server` project.
2026-11-11 23:52:22 +01:00
57 changed files with 1161 additions and 4036 deletions

View File

@@ -59,11 +59,6 @@ public record EnvelopeDto : IEnvelope
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
public string Title { get; set; } = string.Empty;
/// <summary>
///
/// </summary>
public ContractType? ContractType { get; set; }
/// <summary>
/// Default value is 'de-DE'
/// </summary>
@@ -72,7 +67,7 @@ public record EnvelopeDto : IEnvelope
/// <summary>
///
/// </summary>
public int? EnvelopeTypeId { get; set; }
public EnvelopeType? Type { get; set; }
// TODO: use ReadAndConfirm property name
/// <summary>
@@ -84,17 +79,12 @@ public record EnvelopeDto : IEnvelope
/// <summary>
///
/// </summary>
public CertificationType? CertificationType { get; set; }
public FinalEmailType? FinalEmailToCreator { get; set; }
/// <summary>
///
/// </summary>
public int? FinalEmailToCreator { get; set; }
/// <summary>
///
/// </summary>
public int? FinalEmailToReceivers { get; set; }
public FinalEmailType? FinalEmailToReceivers { get; set; }
/// <summary>
///
@@ -139,7 +129,7 @@ public record EnvelopeDto : IEnvelope
/// <summary>
///
/// </summary>
public EnvelopeType? EnvelopeType { get; set; }
public EnvelopeTypeDefaultsDto? Defaults { get; set; }
/// <summary>
///

View File

@@ -5,12 +5,12 @@ namespace EnvelopeGenerator.Application.Common.Dto;
/// <summary>
/// Data Transfer Object representing a type of envelope with its configuration settings.
/// </summary>
public class EnvelopeTypeDto
public class EnvelopeTypeDefaultsDto
{
/// <summary>
/// Gets or sets the unique identifier of the envelope type.
/// </summary>
public int Id { get; set; }
public EnvelopeType Id { get; set; }
/// <summary>
/// Gets or sets the title of the envelope type.
@@ -27,11 +27,6 @@ public class EnvelopeTypeDto
/// </summary>
public int? ExpiresDays { get; set; }
/// <summary>
/// Gets or sets the certification type identifier.
/// </summary>
public CertificationType? CertificationType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether an access code is required.
/// </summary>
@@ -40,12 +35,12 @@ public class EnvelopeTypeDto
/// <summary>
/// Gets or sets the final email template ID to be sent to the creator.
/// </summary>
public int? FinalEmailToCreator { get; set; }
public FinalEmailType? FinalEmailToCreator { get; set; }
/// <summary>
/// Gets or sets the final email template ID to be sent to the receivers.
/// </summary>
public int? FinalEmailToReceivers { get; set; }
public FinalEmailType? FinalEmailToReceivers { get; set; }
/// <summary>
/// Gets or sets the timestamp when this envelope type was added.
@@ -76,9 +71,4 @@ public class EnvelopeTypeDto
/// Gets or sets the interval in days between reminder emails.
/// </summary>
public int? ReminderIntervalDays { get; set; }
/// <summary>
/// Gets or sets the contract type associated with the envelope type.
/// </summary>
public ContractType? ContractType { get; set; }
}

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -7,6 +8,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
///
/// </summary>
[Obsolete("Use IRepository")]
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeType, int>
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeTypeDefaults, EnvelopeType>
{
}

View File

@@ -1,5 +1,6 @@
using DigitalData.Core.Abstraction.Application;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
@@ -8,6 +9,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
///
/// </summary>
[Obsolete("Use MediatR")]
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults, EnvelopeType>
{
}

View File

@@ -0,0 +1,47 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentAccessCodeReceived"/> template.
/// </summary>
public record DocumentAccessCodeReceivedNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[NAME_SENDER]</c> in mail body.
/// </summary>
public required string NameSender { get; init; }
/// <summary>
/// Determines <c>[SIGNATURE_TYPE]</c> text in mail body.
/// </summary>
public required bool IsReadAndConfirm { private get; init; }
/// <summary>
/// Replaces <c>[SIGNATURE_TYPE]</c> in mail body.
/// </summary>
public string SignatureType => IsReadAndConfirm ? "Signieren" : "Lesen und bestätigen";
/// <summary>
/// Replaces <c>[DOCUMENT_ACCESS_CODE]</c> in mail body.
/// </summary>
public required string DocumentAccessCode { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentAccessCodeReceived;
}

View File

@@ -0,0 +1,27 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentCompleted"/> template.
/// </summary>
public record DocumentCompletedNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentCompleted;
}

View File

@@ -0,0 +1,37 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentDeleted"/> template.
/// </summary>
public record DocumentDeletedNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[NAME_SENDER]</c> in mail body.
/// </summary>
public required string NameSender { get; init; }
/// <summary>
/// Replaces <c>[REASON]</c> in mail body.
/// </summary>
public required string Reason { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentDeleted;
}

View File

@@ -0,0 +1,37 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentRejected_ADM"/> template.
/// </summary>
public record DocumentRejectedAdmNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_SENDER]</c> in mail body.
/// </summary>
public required string NameSender { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[REASON]</c> in mail body.
/// </summary>
public required string Reason { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_ADM;
}

View File

@@ -0,0 +1,32 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentRejected_REC_2"/> template.
/// </summary>
public record DocumentRejectedRec2Notification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[NAME_SENDER]</c> in mail body.
/// </summary>
public required string NameSender { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_REC_2;
}

View File

@@ -0,0 +1,32 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentRejected_REC"/> template.
/// </summary>
public record DocumentRejectedRecNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Replaces <c>[NAME_SENDER]</c> in mail body.
/// </summary>
public required string NameSender { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_REC;
}

View File

@@ -0,0 +1,57 @@
using EnvelopeGenerator.Application.Common.Extensions;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.DocumentShared"/> template.
/// </summary>
public record DocumentSharedNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[DOCUMENT_TITLE]</c> in mail subject/body.
/// </summary>
public required string DocumentTitle { get; init; }
/// <summary>
/// Replaces <c>[NAME_RECEIVER]</c> in mail body.
/// </summary>
public required string NameReceiver { get; init; }
/// <summary>
/// Base host used to build document link placeholders.
/// </summary>
public required Uri Origin { private get; init; }
/// <summary>
/// Read-only share identifier used to build link placeholders.
/// </summary>
public required long ReadOnlyId { private get; init; }
private Uri EnvelopeUrl => new(Origin, $"EnvelopeKey/{ReadOnlyId.ToEnvelopeKey()}");
/// <summary>
/// Replaces <c>[LINK_TO_DOCUMENT]</c> in mail body.
/// </summary>
public string LinkToDocument => EnvelopeUrl.AbsoluteUri;
/// <summary>
/// Replaces <c>[LINK_TO_DOCUMENT_TEXT]</c> in mail body.
/// </summary>
public string LinkToDocumentText
{
get
{
var urlText = EnvelopeUrl.ToString();
return $"{urlText[..Math.Min(urlText.Length, 40)]}..";
}
}
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentShared;
}

View File

@@ -0,0 +1,27 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
/// <summary>
/// Payload for <see cref="EmailTemplateType.TotpSecret"/> template.
/// </summary>
public record TotpSecretNotification : EnvelopeNotificationBase
{
/// <summary>
/// Replaces <c>[TFA_EXPIRATION]</c> in mail body.
/// </summary>
public required string TfaExpiration { get; init; }
/// <summary>
/// Replaces <c>[TFA_QR_CODE]</c> in mail body.
/// </summary>
public required string TfaQrCode { get; init; }
/// <summary>
/// Replaces <c>[NAME_PORTAL]</c> in mail body.
/// </summary>
public string NamePortal { get; init; } = "signFLOW Portal";
/// <inheritdoc />
public override EmailTemplateType GetTemplateType() => EmailTemplateType.TotpSecret;
}

View File

@@ -30,14 +30,14 @@ public class MappingProfile : Profile
CreateMap<EmailTemplate, EmailTemplateDto>();
CreateMap<Envelope, EnvelopeDto>()
.ForMember(dest => dest.EnvelopeTypeTitle,
opt => opt.MapFrom(src => src.Type != null ? src.Type.Title : null));
opt => opt.MapFrom(src => src.Defaults != null ? src.Defaults.Title : null));
CreateMap<Document, DocumentDto>();
CreateMap<Document, DocumentDetailsDto>();
CreateMap<History, HistoryDto>().ForMember(dest => dest.ActionDate, opt => opt.MapFrom(src => src.ChangedWhen));
CreateMap<History, HistoryCreateDto>().ForMember(dest => dest.ActionDate, opt => opt.MapFrom(src => src.ChangedWhen));
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
CreateMap<EnvelopeReceiver, EnvelopeReceiverSecretDto>();
CreateMap<EnvelopeType, EnvelopeTypeDto>();
CreateMap<EnvelopeTypeDefaults, EnvelopeTypeDefaultsDto>();
CreateMap<Receiver, ReceiverDto>();
CreateMap<EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
CreateMap<ElementAnnotation, AnnotationDto>();
@@ -55,7 +55,7 @@ public class MappingProfile : Profile
CreateMap<HistoryDto, History>().ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(src => src.ActionDate));
CreateMap<HistoryCreateDto, History>().ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(src => src.ActionDate));
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();
CreateMap<EnvelopeTypeDto, EnvelopeType>();
CreateMap<EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults>();
CreateMap<ReceiverDto, Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
CreateMap<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnly>();
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, EnvelopeReceiverReadOnly>();

View File

@@ -12,6 +12,7 @@ using EnvelopeGenerator.Application.DocReceiverElements.Commands;
using EnvelopeGenerator.Application.DocReceiverElements.Behaviors;
using EnvelopeGenerator.Application.Common.Behaviors;
using FluentValidation;
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
namespace EnvelopeGenerator.Application;
@@ -53,6 +54,7 @@ public static class DependencyInjection
services.Configure<AuthenticatorParams>(config.GetSection(nameof(AuthenticatorParams)));
services.Configure<TotpSmsParams>(config.GetSection(nameof(TotpSmsParams)));
services.Configure<ESignParams>(config.GetSection(nameof(ESignParams)));
services.Configure<SendAccessCodeParams>(config.GetSection(nameof(SendAccessCodeParams)));
services.AddHttpClientService<GtxMessagingParams>(config.GetSection(nameof(GtxMessagingParams)));
services.TryAddScoped<ISmsSender, GTXSmsSender>(); // Changed: Singleton → Scoped

View File

@@ -0,0 +1,151 @@
using DigitalData.Core.Exceptions;
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
using EnvelopeGenerator.Application.Common.Interfaces.Services;
using EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
using EnvelopeGenerator.Application.EnvelopeReceivers.Queries;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Exceptions;
using MediatR;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
/// <summary>
///
/// </summary>
/// <param name="Key"></param>
public record SendAccessCodeCommand(string Key) : IRequest<SendAccessCodeResult>
{
internal bool MultipleRequestsAllowed { get; private set; } = false;
/// <summary>
///
/// </summary>
/// <returns></returns>
public SendAccessCodeCommand AllowMultipleRequests(bool allow = true)
{
MultipleRequestsAllowed = allow;
return this;
}
}
/// <summary>
/// Business result of an access-code request.
/// </summary>
public enum SendAccessCodeResult
{
/// <summary>
/// Access code sent successfully. HTTP: 200 OK.
/// </summary>
Sent,
/// <summary>
/// Receiver has already signed this envelope; requesting a code is no longer applicable. HTTP: 409 Conflict.
/// </summary>
AlreadySigned,
/// <summary>
/// Envelope does not require an access code. HTTP: 200 OK (or 204 No Content).
/// </summary>
NoAccessCodeRequired,
/// <summary>
/// Access code was already requested and the request limit/rule blocks another send. HTTP: 429 Too Many Requests.
/// </summary>
RequestLimitExceeded
}
/// <summary>
///
/// </summary>
public class SendAccessCodeCommandHandler(IMediator Sender, IEnvelopeHistoryService HistoryService, IEnvelopeNotificationService NtfService, IOptions<SendAccessCodeParams> options, IMemoryCache Cache) : IRequestHandler<SendAccessCodeCommand, SendAccessCodeResult>
{
/// <summary>
///
/// </summary>
public readonly SendAccessCodeParams Options = options.Value;
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="cancel"></param>
/// <returns></returns>
public async Task<SendAccessCodeResult> Handle(SendAccessCodeCommand request, CancellationToken cancel)
{
// read envelope receiver
var ers = (await Sender.Send(new ReadEnvelopeReceiverQuery
{
Key = request.Key,
}, cancel));
if (ers.SingleOrDefault() is not EnvelopeReceiverDto er || er.Envelope is null || er.Receiver is null)
throw new NotFoundException($"Envelope receiver with key '{request.Key}' not found.");
if (!er.Envelope.UseAccessCode)
return SendAccessCodeResult.NoAccessCodeRequired;
var userReference = er.Receiver.EmailAddress;
if (await HistoryService.IsSigned(er.EnvelopeId, userReference))
return SendAccessCodeResult.AlreadySigned;
var accessCodeAlreadyRequested = await HistoryService.AccessCodeAlreadyRequested(er.EnvelopeId, userReference);
if (accessCodeAlreadyRequested && (!request.MultipleRequestsAllowed || await IsAccessCodeRequestsDisabled(request.Key, cancel)))
return SendAccessCodeResult.RequestLimitExceeded;
// create a history record
if (!accessCodeAlreadyRequested)
{
var historyResult = await HistoryService.RecordAsync(er.EnvelopeId, userReference, EnvelopeStatus.AccessCodeRequested);
if (historyResult.IsFailed)
{
throw new ApplicationException($"Failed to record AccessCodeRequested history for envelope {er.EnvelopeId} and receiver {userReference}.");
}
}
if (er.AccessCode is null)
throw new DataIntegrityException($"Access code is null for envelope receiver with key '{request.Key}' although use-access-code is true.");
await NtfService.Notify(er.Receiver.EmailAddress, new DocumentAccessCodeReceivedNotification()
{
DocumentAccessCode = er.AccessCode,
DocumentTitle = er.Envelope.Title,
NameReceiver = er.Name ?? string.Empty,
IsReadAndConfirm = er.Envelope.Type == EnvelopeType.ReadAndConfirm,
NameSender = er.Envelope.User!.Username,
}, cancel);
await DisableAccessCodeRequests(request.Key, cancel);
return SendAccessCodeResult.Sent;
}
private static string DisableAccessCodeRequestsCacheKeyPrefix => "DisableAccessCodeRequests_";
/// <summary>
///
/// </summary>
/// <param name="envelopeKey"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
private Task<bool> IsAccessCodeRequestsDisabled(string envelopeKey, CancellationToken cancellationToken = default)
{
bool hasCache = Cache.TryGetValue<bool>(DisableAccessCodeRequestsCacheKeyPrefix + envelopeKey, out var disabled);
return Task.FromResult(hasCache && disabled);
}
/// <summary>
///
/// </summary>
/// <param name="envelopeKey"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
private Task DisableAccessCodeRequests(string envelopeKey, CancellationToken cancellationToken = default)
{
Cache.Set(DisableAccessCodeRequestsCacheKeyPrefix + envelopeKey, true, Options.RepeatRequestBlockingPeriod);
return Task.CompletedTask;
}
}

View File

@@ -0,0 +1,12 @@
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
/// <summary>
///
/// </summary>
public record SendAccessCodeParams
{
/// <summary>
///
/// </summary>
public TimeSpan RepeatRequestBlockingPeriod { get; init; } = TimeSpan.FromMinutes(1);
}

View File

@@ -9,20 +9,20 @@ namespace EnvelopeGenerator.Application.EnvelopeTypes.Queries;
/// <summary>
///
/// </summary>
public record ReadEnvelopeTypesQuery : IRequest<IEnumerable<EnvelopeTypeDto>>;
public record ReadEnvelopeTypesQuery : IRequest<IEnumerable<EnvelopeTypeDefaultsDto>>;
/// <summary>
///
/// </summary>
public class ReadEnvelopeTypesQueryHandler : IRequestHandler<ReadEnvelopeTypesQuery, IEnumerable<EnvelopeTypeDto>>
public class ReadEnvelopeTypesQueryHandler : IRequestHandler<ReadEnvelopeTypesQuery, IEnumerable<EnvelopeTypeDefaultsDto>>
{
private readonly IRepository<EnvelopeType> _repository;
private readonly IRepository<EnvelopeTypeDefaults> _repository;
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
public ReadEnvelopeTypesQueryHandler(IRepository<EnvelopeType> repository)
public ReadEnvelopeTypesQueryHandler(IRepository<EnvelopeTypeDefaults> repository)
{
_repository = repository;
}
@@ -33,29 +33,27 @@ public class ReadEnvelopeTypesQueryHandler : IRequestHandler<ReadEnvelopeTypesQu
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<IEnumerable<EnvelopeTypeDto>> Handle(ReadEnvelopeTypesQuery request, CancellationToken cancellationToken)
public async Task<IEnumerable<EnvelopeTypeDefaultsDto>> Handle(ReadEnvelopeTypesQuery request, CancellationToken cancellationToken)
{
// TODO: Temporary manual projection to avoid null-materialization crashes from legacy nullable DB columns in EnvelopeType.
// Revisit and switch to AutoMapper query projection (ProjectTo) after schema nullability and mapping contracts are stabilized.
return await _repository.Query
.AsNoTracking()
.Select(t => new EnvelopeTypeDto
.Select(t => new EnvelopeTypeDefaultsDto
{
Id = t.Id,
Title = t.Title ?? string.Empty,
Language = string.IsNullOrWhiteSpace(t.Language) ? "de-DE" : t.Language,
ExpiresDays = t.ExpiresDays,
CertificationType = t.CertificationType,
UseAccessCode = t.UseAccessCode,
FinalEmailToCreator = (int?)t.FinalEmailToCreator,
FinalEmailToReceivers = (int?)t.FinalEmailToReceivers,
FinalEmailToCreator = t.FinalEmailToCreator,
FinalEmailToReceivers = t.FinalEmailToReceivers,
AddedWhen = t.AddedWhen,
ChangedWhen = t.ChangedWhen,
ExpiresWarningDays = t.ExpiresWarningDays,
SendReminderEmails = t.SendReminderEmails,
FirstReminderDays = t.FirstReminderDays,
ReminderIntervalDays = t.ReminderIntervalDays,
ContractType = t.ContractType
})
.ToListAsync(cancellationToken);
}

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Common.Dto;
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using EnvelopeGenerator.Domain.Constants;
using MediatR;
@@ -21,7 +22,7 @@ public record CreateEnvelopeCommand : IRequest<EnvelopeDto?>
/// <summary>
/// Kennung des ausgewaehlten Umschlagtyps (Vorlage).
/// </summary>
public int? EnvelopeTypeId { get; set; }
public EnvelopeType? Type { get; set; }
/// <summary>
/// Sprachcode fuer Umschlaginhalt und Benachrichtigungen.
@@ -33,20 +34,15 @@ public record CreateEnvelopeCommand : IRequest<EnvelopeDto?>
/// </summary>
public bool? UseAccessCode { get; set; }
/// <summary>
/// Zertifizierungstyp fuer den Signaturprozess.
/// </summary>
public CertificationType? CertificationType { get; set; }
/// <summary>
/// Finale E-Mail-Einstellung fuer den Ersteller.
/// </summary>
public int? FinalEmailToCreator { get; set; }
public FinalEmailType? FinalEmailToCreator { get; set; }
/// <summary>
/// Finale E-Mail-Einstellung fuer die Empfaenger.
/// </summary>
public int? FinalEmailToReceivers { get; set; }
public FinalEmailType? FinalEmailToReceivers { get; set; }
/// <summary>
/// Gibt an, ob Erinnerungs-E-Mails aktiviert sind.

View File

@@ -41,7 +41,7 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
private IRepository<EnvelopeReceiver> EnvelopeReceiverRepository => Provider.GetRequiredService<IRepository<EnvelopeReceiver>>();
private IRepository<EnvelopeType> EnvelopeTypeRepository => Provider.GetRequiredService<IRepository<EnvelopeType>>();
private IRepository<EnvelopeTypeDefaults> EnvelopeTypeRepository => Provider.GetRequiredService<IRepository<EnvelopeTypeDefaults>>();
private IRepository<Receiver> ReceiverRepository => Provider.GetRequiredService<IRepository<Receiver>>();
@@ -93,10 +93,9 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
e.Title = title;
e.Message = message;
e.TfaEnabled = request.TFAEnabled;
e.EnvelopeTypeId = settings.EnvelopeTypeId;
e.Type = settings.Type;
e.Language = settings.Language;
e.UseAccessCode = settings.UseAccessCode;
e.CertificationType = settings.CertificationType;
e.FinalEmailToCreator = settings.FinalEmailToCreator;
e.FinalEmailToReceivers = settings.FinalEmailToReceivers;
e.SendReminderEmails = settings.SendReminderEmails;
@@ -104,7 +103,6 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
e.ReminderIntervalDays = settings.ReminderIntervalDays;
e.ExpiresWhenDays = settings.ExpiresWhenDays;
e.ExpiresWarningWhenDays = settings.ExpiresWarningWhenDays;
e.ContractType = settings.ContractType;
e.ExpiresWhen = settings.ExpiresWhen;
e.ExpiresWarningWhen = settings.ExpiresWarningWhen;
e.Status = EnvelopeStatus.EnvelopeSaved;
@@ -114,10 +112,9 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
envelope.Title = title;
envelope.Message = message;
envelope.TfaEnabled = request.TFAEnabled;
envelope.EnvelopeTypeId = settings.EnvelopeTypeId;
envelope.Type = settings.Type;
envelope.Language = settings.Language;
envelope.UseAccessCode = settings.UseAccessCode;
envelope.CertificationType = settings.CertificationType;
envelope.FinalEmailToCreator = settings.FinalEmailToCreator;
envelope.FinalEmailToReceivers = settings.FinalEmailToReceivers;
envelope.SendReminderEmails = settings.SendReminderEmails;
@@ -125,7 +122,6 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
envelope.ReminderIntervalDays = settings.ReminderIntervalDays;
envelope.ExpiresWhenDays = settings.ExpiresWhenDays;
envelope.ExpiresWarningWhenDays = settings.ExpiresWarningWhenDays;
envelope.ContractType = settings.ContractType;
envelope.ExpiresWhen = settings.ExpiresWhen;
envelope.ExpiresWarningWhen = settings.ExpiresWarningWhen;
envelope.Status = EnvelopeStatus.EnvelopeSaved;
@@ -145,11 +141,10 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
AddedWhen = now,
ChangedWhen = now,
Comment = string.Empty,
EnvelopeTypeId = settings.EnvelopeTypeId,
Type = settings.Type,
Language = settings.Language,
TfaEnabled = request.TFAEnabled,
UseAccessCode = settings.UseAccessCode,
CertificationType = settings.CertificationType,
FinalEmailToCreator = settings.FinalEmailToCreator,
FinalEmailToReceivers = settings.FinalEmailToReceivers,
SendReminderEmails = settings.SendReminderEmails,
@@ -158,8 +153,7 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
ExpiresWhenDays = settings.ExpiresWhenDays,
ExpiresWarningWhenDays = settings.ExpiresWarningWhenDays,
ExpiresWhen = settings.ExpiresWhen,
ExpiresWarningWhen = settings.ExpiresWarningWhen,
ContractType = settings.ContractType
ExpiresWarningWhen = settings.ExpiresWarningWhen
}, cancel);
if (request.UseSQLExecutor)
@@ -169,10 +163,9 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
e.Title = title;
e.Message = message;
e.TfaEnabled = request.TFAEnabled;
e.EnvelopeTypeId = settings.EnvelopeTypeId;
e.Type = settings.Type;
e.Language = settings.Language;
e.UseAccessCode = settings.UseAccessCode;
e.CertificationType = settings.CertificationType;
e.FinalEmailToCreator = settings.FinalEmailToCreator;
e.FinalEmailToReceivers = settings.FinalEmailToReceivers;
e.SendReminderEmails = settings.SendReminderEmails;
@@ -182,7 +175,6 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
e.ExpiresWarningWhenDays = settings.ExpiresWarningWhenDays;
e.ExpiresWhen = settings.ExpiresWhen;
e.ExpiresWarningWhen = settings.ExpiresWarningWhen;
e.ContractType = settings.ContractType;
e.Status = EnvelopeStatus.EnvelopeSaved;
e.ChangedWhen = now;
}, e => e.Id == envelope.Id, cancel);
@@ -190,10 +182,9 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
envelope.Title = title;
envelope.Message = message;
envelope.TfaEnabled = request.TFAEnabled;
envelope.EnvelopeTypeId = settings.EnvelopeTypeId;
envelope.Type = settings.Type;
envelope.Language = settings.Language;
envelope.UseAccessCode = settings.UseAccessCode;
envelope.CertificationType = settings.CertificationType;
envelope.FinalEmailToCreator = settings.FinalEmailToCreator;
envelope.FinalEmailToReceivers = settings.FinalEmailToReceivers;
envelope.SendReminderEmails = settings.SendReminderEmails;
@@ -203,7 +194,6 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
envelope.ExpiresWarningWhenDays = settings.ExpiresWarningWhenDays;
envelope.ExpiresWhen = settings.ExpiresWhen;
envelope.ExpiresWarningWhen = settings.ExpiresWarningWhen;
envelope.ContractType = settings.ContractType;
envelope.Status = EnvelopeStatus.EnvelopeSaved;
envelope.ChangedWhen = now;
}
@@ -233,12 +223,12 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
private async Task<EnvelopeSettings> ResolveEnvelopeSettingsAsync(CreateEnvelopeCommand request, Envelope? existing, CancellationToken cancel)
{
EnvelopeType? selectedType = null;
if (request.EnvelopeTypeId is int envelopeTypeId && envelopeTypeId > 0)
EnvelopeTypeDefaults? selectedType = null;
if (request.Type is EnvelopeType type)
{
selectedType = await EnvelopeTypeRepository.Query
.FirstOrDefaultAsync(t => t.Id == envelopeTypeId, cancel)
?? throw new BadRequestException($"Envelope type {envelopeTypeId} not found.");
.FirstOrDefaultAsync(t => t.Id == type, cancel)
?? throw new BadRequestException($"Envelope type {type} not found.");
}
var expiresWhenDays = Math.Max(0,
@@ -262,21 +252,17 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
useAccessCode = true;
return new EnvelopeSettings(
EnvelopeTypeId: request.EnvelopeTypeId ?? existing?.EnvelopeTypeId,
Type: request.Type ?? existing?.Type,
Language: ResolveLanguage(request.Language, selectedType?.Language, existing?.Language),
UseAccessCode: useAccessCode,
CertificationType: request.CertificationType
?? selectedType?.CertificationType
?? existing?.CertificationType
?? CertificationType.AdvancedElectronicSignature,
FinalEmailToCreator: request.FinalEmailToCreator
?? (int?)selectedType?.FinalEmailToCreator
?? selectedType?.FinalEmailToCreator
?? existing?.FinalEmailToCreator
?? (int)FinalEmailType.No,
?? FinalEmailType.No,
FinalEmailToReceivers: request.FinalEmailToReceivers
?? (int?)selectedType?.FinalEmailToReceivers
?? selectedType?.FinalEmailToReceivers
?? existing?.FinalEmailToReceivers
?? (int)FinalEmailType.No,
?? FinalEmailType.No,
SendReminderEmails: request.SendReminderEmails
?? selectedType?.SendReminderEmails
?? existing?.SendReminderEmails
@@ -294,10 +280,7 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
ExpiresWhenDays: expiresWhenDays,
ExpiresWarningWhenDays: expiresWarningWhenDays,
ExpiresWhen: expiresWhenDays > 0 ? DateTime.Now.AddDays(expiresWhenDays) : null,
ExpiresWarningWhen: expiresWarningWhenDays > 0 ? DateTime.Now.AddDays(expiresWarningWhenDays) : null,
ContractType: existing?.ContractType
?? selectedType?.ContractType
?? ContractType.Contract);
ExpiresWarningWhen: expiresWarningWhenDays > 0 ? DateTime.Now.AddDays(expiresWarningWhenDays) : null);
}
private static string ResolveLanguage(string? preferred, string? fallback1, string? fallback2)
@@ -315,20 +298,18 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
}
private sealed record EnvelopeSettings(
int? EnvelopeTypeId,
EnvelopeType? Type,
string Language,
bool UseAccessCode,
CertificationType CertificationType,
int FinalEmailToCreator,
int FinalEmailToReceivers,
FinalEmailType FinalEmailToCreator,
FinalEmailType FinalEmailToReceivers,
bool SendReminderEmails,
int FirstReminderDays,
int ReminderIntervalDays,
int ExpiresWhenDays,
int ExpiresWarningWhenDays,
DateTime? ExpiresWhen,
DateTime? ExpiresWarningWhen,
ContractType ContractType);
DateTime? ExpiresWarningWhen);
private async Task<string> ResolveSenderReferenceAsync(Envelope envelope, CancellationToken cancel)
{
@@ -584,13 +565,12 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
{
foreach (var er in envRcvs)
{
var advancedSignature = envelope.CertificationType == CertificationType.AdvancedElectronicSignature;
var origin = new Uri(ReqCntxt.Origin ?? throw new InvalidOperationException($"The request origin is missing in {nameof(CreateEnvelopeCommandHandler)}."));
try
{
await EnvNtfService.Notify(er.Receiver.EmailAddress, new DocumentReceivedNotification
{
AdvancedSignature = advancedSignature,
AdvancedSignature = envelope.Type == EnvelopeType.AdvancedSignature,
DocumentTitle = envelope.Title ?? string.Empty,
NameReceiver = er.Name ?? string.Empty,
EnvelopeUuid = envelope.Uuid,

View File

@@ -170,10 +170,8 @@ public class ReadEnvelopeQueryHandler : IRequestHandler<ReadEnvelopeQuery, IEnum
AddedWhen = e.AddedWhen,
ChangedWhen = e.ChangedWhen,
Title = e.Title ?? string.Empty,
ContractType = e.ContractType,
Language = e.Language,
EnvelopeTypeId = e.EnvelopeTypeId,
CertificationType = e.CertificationType,
Type = e.Type,
FinalEmailToCreator = e.FinalEmailToCreator,
FinalEmailToReceivers = e.FinalEmailToReceivers,
SendReminderEmails = e.SendReminderEmails,
@@ -183,7 +181,7 @@ public class ReadEnvelopeQueryHandler : IRequestHandler<ReadEnvelopeQuery, IEnum
ExpiresWarningWhenDays = e.ExpiresWarningWhenDays,
UseAccessCode = e.UseAccessCode ?? true,
TFAEnabled = e.TfaEnabled ?? false,
EnvelopeTypeTitle = e.Type != null ? e.Type.Title : null,
EnvelopeTypeTitle = e.Defaults != null ? e.Defaults.Title : null,
IsAlreadySent = false,
DocResult = null,
Documents = null,
@@ -237,7 +235,7 @@ public class ReadEnvelopeQueryHandler : IRequestHandler<ReadEnvelopeQuery, IEnum
}
var envelopes = await query
.Include(e => e.Type)
.Include(e => e.Defaults)
.Include(e => e.EnvelopeReceivers).ThenInclude(er => er.Receiver)
.Include(e => e.Histories)
.ToListAsync(cancel);

View File

@@ -703,10 +703,19 @@
<data name="ReceiverLogin_AccessCode_Placeholder" xml:space="preserve"><value>Zugangscode eingeben</value></data>
<data name="ReceiverLogin_Description" xml:space="preserve"><value>Bitte geben Sie den Zugangscode ein, den Sie per E-Mail erhalten haben, um das Dokument sicher zu öffnen.</value></data>
<data name="ReceiverLogin_FooterHelp" xml:space="preserve"><value>Bei Problemen wenden Sie sich bitte an den Absender des Dokuments.</value></data>
<data name="ReceiverLogin_InfoTitle" xml:space="preserve"><value>Sicherheit ist uns wichtig.</value></data>
<data name="ReceiverLogin_InfoStep1" xml:space="preserve"><value>Direkt nachdem Sie den Link zum Unterzeichnen geöffnet haben, haben wir Ihnen eine zweite E-Mail gesendet.</value></data>
<data name="ReceiverLogin_InfoStep2" xml:space="preserve"><value>Darin finden Sie den Zugangscode, den Sie hier eingeben müssen.</value></data>
<data name="ReceiverLogin_InvalidCode_Body" xml:space="preserve"><value>Der eingegebene Code ist falsch. Bitte versuchen Sie es erneut.</value></data>
<data name="ReceiverLogin_InvalidCode_Title" xml:space="preserve"><value>Ungültiger Zugangscode.</value></data>
<data name="ReceiverLogin_NotFound_Body" xml:space="preserve"><value>Der angegebene Zugangscode konnte keinem Dokument zugeordnet werden. Bitte prüfen Sie den Link in Ihrer E-Mail.</value></data>
<data name="ReceiverLogin_NotFound_Title" xml:space="preserve"><value>Dokument nicht gefunden.</value></data>
<data name="ReceiverLogin_ResendAction" xml:space="preserve"><value>Code erneut senden</value></data>
<data name="ReceiverLogin_ResendError" xml:space="preserve"><value>Der Zugangscode konnte nicht erneut gesendet werden. Bitte versuchen Sie es später erneut.</value></data>
<data name="ReceiverLogin_ResendInProgress" xml:space="preserve"><value>Code wird gesendet ...</value></data>
<data name="ReceiverLogin_ResendPrompt" xml:space="preserve"><value>Zugangscode nicht bekommen?</value></data>
<data name="ReceiverLogin_ResendRateLimit" xml:space="preserve"><value>Sie haben soeben einen Code angefordert. Bitte warten Sie kurz und versuchen Sie es erneut.</value></data>
<data name="ReceiverLogin_ResendSuccess" xml:space="preserve"><value>Wir haben Ihnen soeben einen neuen Zugangscode per E-Mail gesendet.</value></data>
<data name="ReceiverLogin_Subtitle" xml:space="preserve"><value>Sicherer Zugang mit Zugangscode</value></data>
<data name="ReceiverSigned_ConfirmBody" xml:space="preserve"><value>Diese Aktion kann nicht rückgängig gemacht werden. Mit der Bestätigung erklären Sie, das oben angezeigte Dokument elektronisch unterzeichnet zu haben. Das unterzeichnete Dokument wird anschließend an alle beteiligten Parteien übermittelt.</value></data>
<data name="ReceiverSigned_ConfirmQuestion" xml:space="preserve"><value>Möchten Sie das Dokument verbindlich unterschreiben?</value></data>
@@ -772,13 +781,18 @@
<data name="SenderEditor_Validation_SignatureFieldRequired" xml:space="preserve"><value>Bitte platzieren Sie mindestens ein Signaturfeld.</value></data>
<data name="SenderEditor_Validation_TitleRequired" xml:space="preserve"><value>Bitte geben Sie einen Titel ein.</value></data>
<data name="SenderEditor_Validation_UploadPdf" xml:space="preserve"><value>Bitte laden Sie zuerst ein PDF-Dokument hoch.</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Bitte melden Sie sich mit Ihren Zugangsdaten an, um auf das Sender-Dashboard zuzugreifen.</value></data>
<data name="SenderLogin_BackToHome" xml:space="preserve"><value>← Zurück zur Startseite</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Melden Sie sich mit denselben Zugangsdaten an wie an Ihrem Arbeitsplatz-PC.</value></data>
<data name="SenderLogin_FooterHelp" xml:space="preserve"><value>Bei Problemen wenden Sie sich bitte an den Administrator.</value></data>
<data name="SenderLogin_InvalidCredentials_Body" xml:space="preserve"><value>Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.</value></data>
<data name="SenderLogin_InvalidCredentials_Title" xml:space="preserve"><value>Ungültige Anmeldedaten.</value></data>
<data name="SenderLogin_Password_Placeholder" xml:space="preserve"><value>Passwort eingeben</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Sicherer Zugang zum Sender-Dashboard</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Sender Anmeldung</value></data>
<data name="SenderLogin_RequiredFields_Body" xml:space="preserve"><value>Bitte Benutzername und Passwort eingeben.</value></data>
<data name="SenderLogin_RequiredFields_Title" xml:space="preserve"><value>Pflichtfelder fehlen.</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Dokumente zur Unterschrift vorbereiten und versenden</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Anmeldung</value></data>
<data name="SenderLogin_Username_Label" xml:space="preserve"><value>Benutzername, z. B. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>z. B. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>Benutzername eingeben</value></data>
<data name="ServerError" xml:space="preserve"><value>Serverfehler.</value></data>
<data name="Signed" xml:space="preserve"><value>Unterschrieben</value></data>

View File

@@ -703,10 +703,19 @@
<data name="ReceiverLogin_AccessCode_Placeholder" xml:space="preserve"><value>Enter access code</value></data>
<data name="ReceiverLogin_Description" xml:space="preserve"><value>Please enter the access code you received by email to securely open the document.</value></data>
<data name="ReceiverLogin_FooterHelp" xml:space="preserve"><value>If you have issues, please contact the document sender.</value></data>
<data name="ReceiverLogin_InfoTitle" xml:space="preserve"><value>Your security matters to us.</value></data>
<data name="ReceiverLogin_InfoStep1" xml:space="preserve"><value>Right after you opened the signing link, we sent you a second email.</value></data>
<data name="ReceiverLogin_InfoStep2" xml:space="preserve"><value>That email contains the access code you need to enter here.</value></data>
<data name="ReceiverLogin_InvalidCode_Body" xml:space="preserve"><value>The entered code is incorrect. Please try again.</value></data>
<data name="ReceiverLogin_InvalidCode_Title" xml:space="preserve"><value>Invalid access code.</value></data>
<data name="ReceiverLogin_NotFound_Body" xml:space="preserve"><value>The provided access code could not be matched to a document. Please verify the link in your email.</value></data>
<data name="ReceiverLogin_NotFound_Title" xml:space="preserve"><value>Document not found.</value></data>
<data name="ReceiverLogin_ResendAction" xml:space="preserve"><value>Resend code</value></data>
<data name="ReceiverLogin_ResendError" xml:space="preserve"><value>The access code could not be resent. Please try again later.</value></data>
<data name="ReceiverLogin_ResendInProgress" xml:space="preserve"><value>Sending code ...</value></data>
<data name="ReceiverLogin_ResendPrompt" xml:space="preserve"><value>Did not receive the access code?</value></data>
<data name="ReceiverLogin_ResendRateLimit" xml:space="preserve"><value>You just requested a code. Please wait a moment and try again.</value></data>
<data name="ReceiverLogin_ResendSuccess" xml:space="preserve"><value>We just sent you a new access code by email.</value></data>
<data name="ReceiverLogin_Subtitle" xml:space="preserve"><value>Secure access with access code</value></data>
<data name="ReceiverSigned_ConfirmBody" xml:space="preserve"><value>This action cannot be undone. By confirming, you declare that you have electronically signed the document shown above. The signed document will then be delivered to all involved parties.</value></data>
<data name="ReceiverSigned_ConfirmQuestion" xml:space="preserve"><value>Do you want to sign this document as binding?</value></data>
@@ -772,13 +781,18 @@
<data name="SenderEditor_Validation_SignatureFieldRequired" xml:space="preserve"><value>Please place at least one signature field.</value></data>
<data name="SenderEditor_Validation_TitleRequired" xml:space="preserve"><value>Please enter a title.</value></data>
<data name="SenderEditor_Validation_UploadPdf" xml:space="preserve"><value>Please upload a PDF document first.</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Please sign in with your credentials to access the sender dashboard.</value></data>
<data name="SenderLogin_BackToHome" xml:space="preserve"><value>← Back to home page</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Sign in with the same credentials you use on your workplace PC.</value></data>
<data name="SenderLogin_FooterHelp" xml:space="preserve"><value>If you have issues, please contact the administrator.</value></data>
<data name="SenderLogin_InvalidCredentials_Body" xml:space="preserve"><value>Username or password is incorrect. Please try again.</value></data>
<data name="SenderLogin_InvalidCredentials_Title" xml:space="preserve"><value>Invalid credentials.</value></data>
<data name="SenderLogin_Password_Placeholder" xml:space="preserve"><value>Enter password</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Secure access to sender dashboard</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Sender login</value></data>
<data name="SenderLogin_RequiredFields_Body" xml:space="preserve"><value>Please enter username and password.</value></data>
<data name="SenderLogin_RequiredFields_Title" xml:space="preserve"><value>Required fields are missing.</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Prepare and send documents for signature</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Sign in</value></data>
<data name="SenderLogin_Username_Label" xml:space="preserve"><value>Username, e.g. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>e.g. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>Enter username</value></data>
<data name="ServerError" xml:space="preserve"><value>Server error.</value></data>
<data name="Signed" xml:space="preserve"><value>Signed</value></data>

View File

@@ -703,10 +703,19 @@
<data name="ReceiverLogin_AccessCode_Placeholder" xml:space="preserve"><value>Saisir le code d'accès</value></data>
<data name="ReceiverLogin_Description" xml:space="preserve"><value>Veuillez saisir le code d'accès reçu par e-mail pour ouvrir le document en toute sécurité.</value></data>
<data name="ReceiverLogin_FooterHelp" xml:space="preserve"><value>En cas de problème, veuillez contacter l'expéditeur du document.</value></data>
<data name="ReceiverLogin_InfoTitle" xml:space="preserve"><value>Votre sécurité est importante pour nous.</value></data>
<data name="ReceiverLogin_InfoStep1" xml:space="preserve"><value>Juste après avoir ouvert le lien de signature, nous vous avons envoyé un second e-mail.</value></data>
<data name="ReceiverLogin_InfoStep2" xml:space="preserve"><value>Cet e-mail contient le code d'accès que vous devez saisir ici.</value></data>
<data name="ReceiverLogin_InvalidCode_Body" xml:space="preserve"><value>Le code saisi est incorrect. Veuillez réessayer.</value></data>
<data name="ReceiverLogin_InvalidCode_Title" xml:space="preserve"><value>Code d'accès invalide.</value></data>
<data name="ReceiverLogin_NotFound_Body" xml:space="preserve"><value>Le code d'accès indiqué ne correspond à aucun document. Veuillez vérifier le lien dans votre e-mail.</value></data>
<data name="ReceiverLogin_NotFound_Title" xml:space="preserve"><value>Document introuvable.</value></data>
<data name="ReceiverLogin_ResendAction" xml:space="preserve"><value>Renvoyer le code</value></data>
<data name="ReceiverLogin_ResendError" xml:space="preserve"><value>Le code d'accès n'a pas pu être renvoyé. Veuillez réessayer plus tard.</value></data>
<data name="ReceiverLogin_ResendInProgress" xml:space="preserve"><value>Envoi du code ...</value></data>
<data name="ReceiverLogin_ResendPrompt" xml:space="preserve"><value>Vous n'avez pas reçu le code d'accès ?</value></data>
<data name="ReceiverLogin_ResendRateLimit" xml:space="preserve"><value>Vous venez de demander un code. Veuillez patienter un instant puis réessayer.</value></data>
<data name="ReceiverLogin_ResendSuccess" xml:space="preserve"><value>Nous venons de vous envoyer un nouveau code d'accès par e-mail.</value></data>
<data name="ReceiverLogin_Subtitle" xml:space="preserve"><value>Accès sécurisé avec code d'accès</value></data>
<data name="ReceiverSigned_ConfirmBody" xml:space="preserve"><value>Cette action est irréversible. En confirmant, vous déclarez avoir signé électroniquement le document affiché ci-dessus. Le document signé sera ensuite transmis à toutes les parties concernées.</value></data>
<data name="ReceiverSigned_ConfirmQuestion" xml:space="preserve"><value>Voulez-vous signer ce document de manière contraignante ?</value></data>
@@ -772,13 +781,18 @@
<data name="SenderEditor_Validation_SignatureFieldRequired" xml:space="preserve"><value>Veuillez placer au moins un champ de signature.</value></data>
<data name="SenderEditor_Validation_TitleRequired" xml:space="preserve"><value>Veuillez saisir un titre.</value></data>
<data name="SenderEditor_Validation_UploadPdf" xml:space="preserve"><value>Veuillez d'abord téléverser un document PDF.</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Veuillez vous connecter avec vos identifiants pour accéder au tableau de bord expéditeur.</value></data>
<data name="SenderLogin_BackToHome" xml:space="preserve"><value>← Retour à la page d'accueil</value></data>
<data name="SenderLogin_Description" xml:space="preserve"><value>Connectez-vous avec les mêmes identifiants que sur votre PC professionnel.</value></data>
<data name="SenderLogin_FooterHelp" xml:space="preserve"><value>En cas de problème, veuillez contacter l'administrateur.</value></data>
<data name="SenderLogin_InvalidCredentials_Body" xml:space="preserve"><value>Le nom d'utilisateur ou le mot de passe est incorrect. Veuillez réessayer.</value></data>
<data name="SenderLogin_InvalidCredentials_Title" xml:space="preserve"><value>Identifiants invalides.</value></data>
<data name="SenderLogin_Password_Placeholder" xml:space="preserve"><value>Saisir le mot de passe</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Accès sécurisé au tableau de bord expéditeur</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Connexion expéditeur</value></data>
<data name="SenderLogin_RequiredFields_Body" xml:space="preserve"><value>Veuillez saisir le nom d'utilisateur et le mot de passe.</value></data>
<data name="SenderLogin_RequiredFields_Title" xml:space="preserve"><value>Champs obligatoires manquants.</value></data>
<data name="SenderLogin_Subtitle" xml:space="preserve"><value>Préparer et envoyer des documents à signer</value></data>
<data name="SenderLogin_Title" xml:space="preserve"><value>Connexion</value></data>
<data name="SenderLogin_Username_Label" xml:space="preserve"><value>Nom d'utilisateur, p. ex. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>p. ex. m.mustermann</value></data>
<data name="SenderLogin_Username_Placeholder" xml:space="preserve"><value>Saisir le nom d'utilisateur</value></data>
<data name="ServerError" xml:space="preserve"><value>Erreur serveur.</value></data>
<data name="Signed" xml:space="preserve"><value>Signé</value></data>

View File

@@ -7,6 +7,7 @@ using DigitalData.Core.Abstraction.Application.DTO;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
using EnvelopeGenerator.Application.Common.Interfaces.Services;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Services;
@@ -14,7 +15,7 @@ namespace EnvelopeGenerator.Application.Services;
///
/// </summary>
[Obsolete("Use MediatR")]
public class EnvelopeTypeService : BasicCRUDService<IEnvelopeTypeRepository, EnvelopeTypeDto, EnvelopeType, int>, IEnvelopeTypeService
public class EnvelopeTypeService : BasicCRUDService<IEnvelopeTypeRepository, EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults, EnvelopeType>, IEnvelopeTypeService
{
private static readonly Guid CacheKey = Guid.NewGuid();
@@ -36,8 +37,8 @@ public class EnvelopeTypeService : BasicCRUDService<IEnvelopeTypeRepository, Env
///
/// </summary>
/// <returns></returns>
public override async Task<DataResult<IEnumerable<EnvelopeTypeDto>>> ReadAllAsync()
public override async Task<DataResult<IEnumerable<EnvelopeTypeDefaultsDto>>> ReadAllAsync()
=> await _cache.GetOrCreateAsync(CacheKey, async entry => await base.ReadAllAsync())
?? Result.Fail<IEnumerable<EnvelopeTypeDto>>().Notice(LogLevel.Error, Flag.NotFound, "No cached envelope types are available in the database. If you have added any envelope types after the server started, please restart the server.");
?? Result.Fail<IEnumerable<EnvelopeTypeDefaultsDto>>().Notice(LogLevel.Error, Flag.NotFound, "No cached envelope types are available in the database. If you have added any envelope types after the server started, please restart the server.");
}

View File

@@ -72,7 +72,7 @@ Public Class EnvelopeModel
oEnvelope.Documents = DocumentModel.List(oEnvelope.Id)
oEnvelope.Histories = HistoryModel.List(oEnvelope.Id)
oEnvelope.Type = EnvelopeTypeModel.GetById(oEnvelope.EnvelopeTypeId)
oEnvelope.Defaults = EnvelopeTypeModel.GetById(oEnvelope.EnvelopeTypeId)
Return oEnvelope
End Function

View File

@@ -8,8 +8,8 @@ Public Class EnvelopeTypeModel
MyBase.New(pState)
End Sub
Private Function ToEnvelopeType(pRow As DataRow) As EnvelopeType
Return New EnvelopeType() With {
Private Function ToEnvelopeType(pRow As DataRow) As EnvelopeTypeDefaults
Return New EnvelopeTypeDefaults() With {
.Id = pRow.ItemEx("GUID", 0),
.Title = pRow.ItemEx("TITLE", ""),
.UseAccessCode = pRow.ItemEx("USE_ACCESS_CODE", False),
@@ -27,7 +27,7 @@ Public Class EnvelopeTypeModel
}
End Function
Public Function GetById(pEnvelopeTypeId As Integer) As EnvelopeType
Public Function GetById(pEnvelopeTypeId As Integer) As EnvelopeTypeDefaults
Dim oSql As String = $"SELECT * FROM TBSIG_ENVELOPE_TYPE WHERE GUID = {pEnvelopeTypeId}"
Dim oTable As DataTable = Database.GetDatatable(oSql)
@@ -39,7 +39,7 @@ Public Class EnvelopeTypeModel
Return ToEnvelopeType(oRow)
End Function
Public Function List() As IEnumerable(Of EnvelopeType)
Public Function List() As IEnumerable(Of EnvelopeTypeDefaults)
Dim oSql As String = $"SELECT * FROM TBSIG_ENVELOPE_TYPE"
Dim oTable As DataTable = Database.GetDatatable(oSql)

View File

@@ -1,4 +1,5 @@
namespace EnvelopeGenerator.Domain.Constants
#if NETFRAMEWORK
namespace EnvelopeGenerator.Domain.Constants
{
public enum CertificationType
{
@@ -6,3 +7,4 @@
ElectronicSignature = 2
}
}
#endif

View File

@@ -1,4 +1,5 @@
namespace EnvelopeGenerator.Domain.Constants
#if NETFRAMEWORK
namespace EnvelopeGenerator.Domain.Constants
{
public enum ContractType
{
@@ -6,3 +7,4 @@
ReadAndSign = 2
}
}
#endif

View File

@@ -0,0 +1,40 @@
#if NETFRAMEWORK
using System;
using System.Linq;
#endif
using EnvelopeGenerator.Domain.Exceptions;
namespace EnvelopeGenerator.Domain.Constants
{
public enum EnvelopeType
{
SimpleSignature = 1,
ReadAndConfirm = 2,
AdvancedSignature = 3
}
public static class EnvelopeTypeExtensions
{
public static EnvelopeType ToEnvelopeType(this int envelopeTypeId)
{
if (!Enum.IsDefined(typeof(EnvelopeType), envelopeTypeId))
{
#if NETFRAMEWORK
var values = Enum.GetValues(typeof(EnvelopeType)).Cast<EnvelopeType>();
#else
var values = Enum.GetValues<EnvelopeType>();
#endif
var validValues = string.Join(", ", values.Select(value => $"{(int)value} = {value}"));
throw new DataIntegrityException(
$"Invalid EnvelopeTypeId '{envelopeTypeId}' for envelope. " +
$"Valid {nameof(EnvelopeType)} values are: [{validValues}]. " +
"This indicates a data integrity issue: the envelope may have been " +
"created or updated with an invalid EnvelopeType in the database.");
}
return (EnvelopeType)Enum.ToObject(typeof(EnvelopeType), envelopeTypeId);
}
}
}

View File

@@ -82,8 +82,11 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("COMMENT", TypeName = "nvarchar(128)")]
public string Comment { get; set; }
#if NETFRAMEWORK
[Column("CONTRACT_TYPE")]
public ContractType? ContractType { get; set; }
#endif
#if NETFRAMEWORK
[NotMapped]
@@ -103,24 +106,32 @@ namespace EnvelopeGenerator.Domain.Entities
public int? ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")]
public int? EnvelopeTypeId { get; set; }
#if NET
public EnvelopeType? Type { get; set; }
#elif NETFRAMEWORK
public int EnvelopeTypeId { get; set; }
#endif
[JsonIgnore]
[NotMapped]
[Obsolete("Use EnvelopeGenerator.Domain.Interfaces.EnvelopeExtensions.IsReadAndConfirm extension method instead.")]
public bool ReadOnly => this.IsReadAndConfirm();
#if NETFRAMEWORK
[Column("CERTIFICATION_TYPE")]
public CertificationType? CertificationType { get; set; }
#endif
[Column("USE_ACCESS_CODE")]
public bool? UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public int? FinalEmailToCreator { get; set; }
public FinalEmailType? FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public int? FinalEmailToReceivers { get; set; }
public FinalEmailType? FinalEmailToReceivers { get; set; }
[Column("EXPIRES_WHEN_DAYS")]
public int? ExpiresWhenDays { get; set; }
@@ -149,12 +160,12 @@ namespace EnvelopeGenerator.Domain.Entities
DocResult
{ get; set; }
[ForeignKey("EnvelopeTypeId")]
public virtual EnvelopeType
[ForeignKey("Type")]
public virtual EnvelopeTypeDefaults
#if nullable
?
#endif
Type
Defaults
{ get; set; }
#if NETFRAMEWORK

View File

@@ -9,12 +9,20 @@ using System;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_TYPE", Schema = "dbo")]
public class EnvelopeType
public class EnvelopeTypeDefaults
{
#if NET
[Key]
[Column("GUID")]
public EnvelopeType Id { get; set; }
#elif NETFRAMEWORK
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; } = 0;
#endif
[Required]
[Column("TITLE", TypeName = "nvarchar(128)")]
@@ -26,17 +34,19 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("EXPIRES_DAYS")]
public int? ExpiresDays { get; set; }
#if NETFRAMEWORK
[Column("CERTIFICATION_TYPE")]
public Constants.CertificationType? CertificationType { get; set; }
public CertificationType? CertificationType { get; set; }
#endif
[Column("USE_ACCESS_CODE")]
public bool? UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public Constants.FinalEmailType? FinalEmailToCreator { get; set; }
public FinalEmailType? FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public Constants.FinalEmailType? FinalEmailToReceivers { get; set; }
public FinalEmailType? FinalEmailToReceivers { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
@@ -57,8 +67,10 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("REMINDER_INTERVAL_DAYS")]
public int? ReminderIntervalDays { get; set; }
#if NETFRAMEWORK
[Column("CONTRACT_TYPE")]
public ContractType? ContractType { get; set; }
#endif
[NotMapped]
public bool TFA_Enabled { get; set; } = false;

View File

@@ -1,8 +1,20 @@
namespace EnvelopeGenerator.Domain.Interfaces
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Exceptions;
#if NETFRAMEWORK
using System;
using System.Linq;
#endif
namespace EnvelopeGenerator.Domain.Interfaces
{
public interface IEnvelope
{
int? EnvelopeTypeId { get; set; }
#if NET
public EnvelopeType? Type { get; set; }
#elif NETFRAMEWORK
int EnvelopeTypeId { get; set; }
#endif
byte[]
#if nullable
@@ -15,12 +27,22 @@
{
public static bool IsReadAndConfirm(this IEnvelope envelope)
{
return envelope.EnvelopeTypeId == 2;
#if NET
return envelope.Type == EnvelopeType.ReadAndConfirm;
#elif NETFRAMEWORK
return envelope.EnvelopeTypeId == (int)EnvelopeType.ReadAndConfirm;
#endif
}
public static bool IsReadAndSign(this IEnvelope envelope)
{
return envelope.EnvelopeTypeId != 2;
#if NET
return envelope.Type != EnvelopeType.ReadAndConfirm;
#elif NETFRAMEWORK
return envelope.EnvelopeTypeId != (int)EnvelopeType.ReadAndConfirm;
#endif
}
public static bool IsBurned(this IEnvelope envelope)

View File

@@ -14,7 +14,7 @@ Public Class frmEnvelopeMainData
Private Property EnvelopeTypeModel As EnvelopeTypeModel
<Bindable(True)>
Private Property EnvelopeType As New EnvelopeType
Private Property EnvelopeType As New EnvelopeTypeDefaults
Public Property State As State
@@ -68,14 +68,14 @@ Public Class frmEnvelopeMainData
chked_2Faktor.EditValue = DEF_TF_ENABLED
Else
If IsNothing(Envelope.Type) Then
Envelope.Type = EnvelopeType
If IsNothing(Envelope.Defaults) Then
Envelope.Defaults = EnvelopeType
End If
If Envelope.Type.ContractType = 0 Then
If Envelope.Defaults.ContractType = 0 Then
cmbEnvelopeType.EditValue = EnvelopeType
Else
' This will trigger loading values from the type
cmbEnvelopeType.EditValue = Envelope.Type
cmbEnvelopeType.EditValue = Envelope.Defaults
' cmbEnvelopeType.SelectedIndex = Convert.ToInt32(Envelope.Type) - 1
' cmbEnvelopeType.SelectedIndex = Envelope.Type.Id - 1
' cmbEnvelopeType.SelectedItem = cmbEnvelopeType.Properties.Items.Cast(Of Type).Where(Function(i) i.Id = Envelope.Type.Id).SingleOrDefault()
@@ -121,12 +121,12 @@ Public Class frmEnvelopeMainData
Return
End If
Dim oEnvelopeType = DirectCast(cmbEnvelopeType.EditValue, EnvelopeType)
Dim oEnvelopeType = DirectCast(cmbEnvelopeType.EditValue, EnvelopeTypeDefaults)
If IsNothing(oEnvelopeType) Then
oEnvelopeType = EnvelopeType
End If
Envelope.Title = txtTitle.EditValue.ToString
Envelope.Type = oEnvelopeType
Envelope.Defaults = oEnvelopeType
Envelope.EnvelopeTypeId = IIf(IsNothing(oEnvelopeType), 0, oEnvelopeType.Id)
Envelope.CertificationType = cmbCertificationType.SelectedIndex + 1
Envelope.Language = cmbLanguage.EditValue
@@ -162,7 +162,7 @@ Public Class frmEnvelopeMainData
End Sub
Private Sub cmbContractType_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbEnvelopeType.SelectedValueChanged
Dim oSelectedType As EnvelopeType = cmbEnvelopeType.SelectedItem
Dim oSelectedType As EnvelopeTypeDefaults = cmbEnvelopeType.SelectedItem
If oSelectedType Is Nothing Then
Exit Sub

View File

@@ -57,7 +57,7 @@ public abstract class EGDbContextBase : DbContext
public DbSet<History> EnvelopeHistories { get; set; }
public DbSet<EnvelopeType> EnvelopeTypes { get; set; }
public DbSet<EnvelopeTypeDefaults> EnvelopeTypes { get; set; }
public DbSet<Receiver> Receivers { get; set; }
@@ -233,7 +233,7 @@ public abstract class EGDbContextBase : DbContext
AddTrigger<History>();
AddTrigger<EnvelopeReceiver>();
AddTrigger<EnvelopeReceiverReadOnly>();
AddTrigger<EnvelopeType>();
AddTrigger<EnvelopeTypeDefaults>();
AddTrigger<Receiver>();
#if NET
AddTrigger<EmailOut>();

View File

@@ -1,813 +0,0 @@
#if NET
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EnvelopeGenerator.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "dbo");
migrationBuilder.CreateTable(
name: "TBDD_CLIENT_USER",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
USER_ID = table.Column<int>(type: "int", nullable: false),
CLIENT_ID = table.Column<int>(type: "int", nullable: false),
COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_CLIENT_USER", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBDD_GROUPS",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
AD_SYNC = table.Column<bool>(type: "bit", nullable: false),
Internal = table.Column<bool>(type: "bit", nullable: false),
Active = table.Column<bool>(type: "bit", nullable: false),
Comment = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ECM_FK_ID = table.Column<int>(type: "int", nullable: false),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_GROUPS", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBDD_MODULES",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
SHORT_NAME = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_MODULES", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBDD_USER",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PRENAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
NAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
USERNAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
SHORTNAME = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
EMAIL = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
LANGUAGE = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false),
COMMENT = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
DELETED = table.Column<bool>(type: "bit", nullable: false),
DATE_FORMAT = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
ACTIVE = table.Column<bool>(type: "bit", nullable: false),
GENERAL_VIEWER = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
WAN_ENVIRONMENT = table.Column<bool>(type: "bit", nullable: false),
USERID_FK_INT_ECM = table.Column<int>(type: "int", nullable: false),
DELETED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false),
DELETED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_USER", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBEMLP_EMAIL_OUT",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
REMINDER_TYPE_ID = table.Column<int>(type: "int", nullable: false),
SENDING_PROFILE = table.Column<int>(type: "int", nullable: false),
REFERENCE_ID = table.Column<int>(type: "int", nullable: false),
REFERENCE_STRING = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true),
ENTITY_ID = table.Column<int>(type: "int", nullable: true),
WF_ID = table.Column<int>(type: "int", nullable: false),
WF_REFERENCE = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true),
EMAIL_ADRESS = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false),
EMAIL_SUBJ = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false),
EMAIL_BODY = table.Column<string>(type: "varchar(max)", nullable: false),
EMAIL_ATTMT1 = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true),
EMAIL_SENT = table.Column<DateTime>(type: "datetime2", nullable: true),
COMMENT = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true),
ADDED_WHO = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
CHANGED_WHO = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: true),
ERROR_TIMESTAMP = table.Column<DateTime>(type: "datetime2", nullable: true),
ERROR_MSG = table.Column<string>(type: "varchar(900)", maxLength: 900, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBEMLP_EMAIL_OUT", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBSIG_CONFIG",
schema: "dbo",
columns: table => new
{
SENDING_PROFILE = table.Column<int>(type: "int", nullable: false),
SIGNATURE_HOST = table.Column<string>(type: "nvarchar(128)", nullable: false),
EXTERNAL_PROGRAM_NAME = table.Column<string>(type: "nvarchar(30)", nullable: true),
EXPORT_PATH = table.Column<string>(type: "nvarchar(256)", nullable: true)
},
constraints: table =>
{
});
migrationBuilder.CreateTable(
name: "TBSIG_EMAIL_TEMPLATE",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
NAME = table.Column<string>(type: "nvarchar(64)", nullable: true),
BODY = table.Column<string>(type: "nvarchar(max)", nullable: true),
SUBJECT = table.Column<string>(type: "nvarchar(512)", nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_EMAIL_TEMPLATE", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_CERTIFICATE",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
ENVELOPE_UUID = table.Column<string>(type: "nvarchar(36)", nullable: false),
ENVELOPE_SUBJECT = table.Column<string>(type: "nvarchar(512)", nullable: false),
CREATOR_ID = table.Column<int>(type: "int", nullable: false),
CREATOR_NAME = table.Column<string>(type: "nvarchar(128)", nullable: false),
CREATOR_EMAIL = table.Column<string>(type: "nvarchar(128)", nullable: false),
ENVELOPE_STATUS = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_CERTIFICATE", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_TYPE",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TITLE = table.Column<string>(type: "nvarchar(128)", nullable: false),
LANGUAGE = table.Column<string>(type: "nvarchar(5)", nullable: true),
EXPIRES_DAYS = table.Column<int>(type: "int", nullable: false),
CERTIFICATION_TYPE = table.Column<int>(type: "int", nullable: false),
USE_ACCESS_CODE = table.Column<bool>(type: "bit", nullable: false),
FINAL_EMAIL_TO_CREATOR = table.Column<int>(type: "int", nullable: false),
FINAL_EMAIL_TO_RECEIVERS = table.Column<int>(type: "int", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
EXPIRES_WARNING_DAYS = table.Column<int>(type: "int", nullable: false),
SEND_REMINDER_EMAILS = table.Column<bool>(type: "bit", nullable: false),
FIRST_REMINDER_DAYS = table.Column<int>(type: "int", nullable: false),
REMINDER_INTERVAL_DAYS = table.Column<int>(type: "int", nullable: false),
CONTRACT_TYPE = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_TYPE", x => x.GUID);
});
migrationBuilder.CreateTable(
name: "TBDD_GROUPS_USER",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
USER_ID = table.Column<int>(type: "int", nullable: false),
GROUP_ID = table.Column<int>(type: "int", nullable: false),
Comment = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_GROUPS_USER", x => x.GUID);
table.ForeignKey(
name: "FK_TBDD_GROUPS_USER_TBDD_GROUPS_GROUP_ID",
column: x => x.GROUP_ID,
principalSchema: "dbo",
principalTable: "TBDD_GROUPS",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBDD_GROUPS_USER_TBDD_USER_USER_ID",
column: x => x.USER_ID,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBDD_USER_MODULES",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
USER_ID = table.Column<int>(type: "int", nullable: false),
MODULE_ID = table.Column<int>(type: "int", nullable: false),
COMMENT = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_USER_MODULES", x => x.GUID);
table.ForeignKey(
name: "FK_TBDD_USER_MODULES_TBDD_MODULES_MODULE_ID",
column: x => x.MODULE_ID,
principalSchema: "dbo",
principalTable: "TBDD_MODULES",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBDD_USER_MODULES_TBDD_USER_USER_ID",
column: x => x.USER_ID,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBDD_USER_REPRESENTATION",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
USER_ID = table.Column<int>(type: "int", nullable: true),
REPR_GROUP = table.Column<int>(type: "int", nullable: true),
GROUP_ID = table.Column<int>(type: "int", nullable: true),
REPR_USER = table.Column<int>(type: "int", nullable: true),
VALID_FROM = table.Column<DateTime>(type: "datetime2", nullable: true),
VALID_TO = table.Column<DateTime>(type: "datetime2", nullable: true),
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBDD_USER_REPRESENTATION", x => x.GUID);
table.ForeignKey(
name: "FK_TBDD_USER_REPRESENTATION_TBDD_GROUPS_GROUP_ID",
column: x => x.GROUP_ID,
principalSchema: "dbo",
principalTable: "TBDD_GROUPS",
principalColumn: "GUID");
table.ForeignKey(
name: "FK_TBDD_USER_REPRESENTATION_TBDD_GROUPS_REPR_GROUP",
column: x => x.REPR_GROUP,
principalSchema: "dbo",
principalTable: "TBDD_GROUPS",
principalColumn: "GUID");
table.ForeignKey(
name: "FK_TBDD_USER_REPRESENTATION_TBDD_USER_REPR_USER",
column: x => x.REPR_USER,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID");
table.ForeignKey(
name: "FK_TBDD_USER_REPRESENTATION_TBDD_USER_USER_ID",
column: x => x.USER_ID,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID");
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
USER_ID = table.Column<int>(type: "int", nullable: false),
STATUS = table.Column<int>(type: "int", nullable: false),
ENVELOPE_UUID = table.Column<string>(type: "nvarchar(36)", nullable: false),
MESSAGE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EXPIRES_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
EXPIRES_WARNING_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
TITLE = table.Column<string>(type: "nvarchar(128)", nullable: true),
CONTRACT_TYPE = table.Column<int>(type: "int", nullable: false),
LANGUAGE = table.Column<string>(type: "nvarchar(5)", nullable: true),
SEND_REMINDER_EMAILS = table.Column<bool>(type: "bit", nullable: false),
FIRST_REMINDER_DAYS = table.Column<int>(type: "int", nullable: false),
REMINDER_INTERVAL_DAYS = table.Column<int>(type: "int", nullable: false),
ENVELOPE_TYPE = table.Column<int>(type: "int", nullable: false),
CERTIFICATION_TYPE = table.Column<int>(type: "int", nullable: false),
USE_ACCESS_CODE = table.Column<bool>(type: "bit", nullable: false),
FINAL_EMAIL_TO_CREATOR = table.Column<int>(type: "int", nullable: false),
FINAL_EMAIL_TO_RECEIVERS = table.Column<int>(type: "int", nullable: false),
EXPIRES_WHEN_DAYS = table.Column<int>(type: "int", nullable: false),
EXPIRES_WARNING_WHEN_DAYS = table.Column<int>(type: "int", nullable: false),
TFA_ENABLED = table.Column<bool>(type: "bit", nullable: false),
DOC_RESULT = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_TBDD_USER_USER_ID",
column: x => x.USER_ID,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_TBSIG_ENVELOPE_TYPE_ENVELOPE_TYPE",
column: x => x.ENVELOPE_TYPE,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE_TYPE",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_DOCUMENT",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
BYTE_DATA = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_DOCUMENT", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_DOCUMENT_TBSIG_ENVELOPE_ENVELOPE_ID",
column: x => x.ENVELOPE_ID,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBSIG_RECEIVER",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EMAIL_ADDRESS = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
SIGNATURE = table.Column<string>(type: "nvarchar(64)", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
TOTP_SECRET_KEY = table.Column<string>(type: "nvarchar(MAX)", nullable: true),
TFA_REG_DEADLINE = table.Column<DateTime>(type: "datetime", nullable: false),
EnvelopeId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_RECEIVER", x => x.GUID);
table.UniqueConstraint("AK_TBSIG_RECEIVER_EMAIL_ADDRESS", x => x.EMAIL_ADDRESS);
table.ForeignKey(
name: "FK_TBSIG_RECEIVER_TBSIG_ENVELOPE_EnvelopeId",
column: x => x.EnvelopeId,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE",
principalColumn: "GUID");
});
migrationBuilder.CreateTable(
name: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DOCUMENT_ID = table.Column<int>(type: "int", nullable: false),
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
ELEMENT_TYPE = table.Column<int>(type: "int", nullable: false),
POSITION_X = table.Column<double>(type: "float", nullable: false),
POSITION_Y = table.Column<double>(type: "float", nullable: false),
WIDTH = table.Column<double>(type: "float", nullable: false),
HEIGHT = table.Column<double>(type: "float", nullable: false),
PAGE = table.Column<int>(type: "int", nullable: false),
REQUIRED = table.Column<bool>(type: "bit", nullable: false),
TOOLTIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
READ_ONLY = table.Column<bool>(type: "bit", nullable: false),
ANNOTATION_INDEX = table.Column<int>(type: "int", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_DOCUMENT_RECEIVER_ELEMENT", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_DOCUMENT_RECEIVER_ELEMENT_TBSIG_ENVELOPE_DOCUMENT_DOCUMENT_ID",
column: x => x.DOCUMENT_ID,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE_DOCUMENT",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBSIG_DOCUMENT_RECEIVER_ELEMENT_TBSIG_RECEIVER_RECEIVER_ID",
column: x => x.RECEIVER_ID,
principalSchema: "dbo",
principalTable: "TBSIG_RECEIVER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBSIG_DOCUMENT_STATUS",
schema: "dbo",
columns: table => new
{
GUID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
STATUS = table.Column<int>(type: "int", nullable: false),
STATUS_CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
VALUE = table.Column<string>(type: "nvarchar(max)", nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_DOCUMENT_STATUS", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_DOCUMENT_STATUS_TBSIG_ENVELOPE_ENVELOPE_ID",
column: x => x.ENVELOPE_ID,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBSIG_DOCUMENT_STATUS_TBSIG_RECEIVER_RECEIVER_ID",
column: x => x.RECEIVER_ID,
principalSchema: "dbo",
principalTable: "TBSIG_RECEIVER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_HISTORY",
schema: "dbo",
columns: table => new
{
GUID = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
USER_REFERENCE = table.Column<string>(type: "nvarchar(128)", nullable: false),
STATUS = table.Column<int>(type: "int", nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
ACTION_DATE = table.Column<DateTime>(type: "datetime", nullable: false),
COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
SenderId = table.Column<int>(type: "int", nullable: true),
ReceiverId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_HISTORY", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_HISTORY_TBDD_USER_SenderId",
column: x => x.SenderId,
principalSchema: "dbo",
principalTable: "TBDD_USER",
principalColumn: "GUID");
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_HISTORY_TBSIG_ENVELOPE_ENVELOPE_ID",
column: x => x.ENVELOPE_ID,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_HISTORY_TBSIG_RECEIVER_ReceiverId",
column: x => x.ReceiverId,
principalSchema: "dbo",
principalTable: "TBSIG_RECEIVER",
principalColumn: "GUID");
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_RECEIVER",
schema: "dbo",
columns: table => new
{
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
SEQUENCE = table.Column<int>(type: "int", nullable: false),
NAME = table.Column<string>(type: "nvarchar(128)", nullable: true),
JOB_TITLE = table.Column<string>(type: "nvarchar(128)", nullable: true),
COMPANY_NAME = table.Column<string>(type: "nvarchar(128)", nullable: true),
PRIVATE_MESSAGE = table.Column<string>(type: "nvarchar(max)", nullable: true),
ACCESS_CODE = table.Column<string>(type: "nvarchar(64)", nullable: true),
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
PHONE_NUMBER = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_RECEIVER", x => new { x.ENVELOPE_ID, x.RECEIVER_ID });
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_RECEIVER_TBSIG_ENVELOPE_ENVELOPE_ID",
column: x => x.ENVELOPE_ID,
principalSchema: "dbo",
principalTable: "TBSIG_ENVELOPE",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_RECEIVER_TBSIG_RECEIVER_RECEIVER_ID",
column: x => x.RECEIVER_ID,
principalSchema: "dbo",
principalTable: "TBSIG_RECEIVER",
principalColumn: "GUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY",
columns: table => new
{
GUID = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ENVELOPE_ID = table.Column<long>(type: "bigint", nullable: false),
RECEIVER_MAIL = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
DATE_VALID = table.Column<DateTime>(type: "datetime2", nullable: false),
ADDED_WHO = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
ADDED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false),
CHANGED_WHO = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
CHANGED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TBSIG_ENVELOPE_RECEIVER_READ_ONLY", x => x.GUID);
table.ForeignKey(
name: "FK_TBSIG_ENVELOPE_RECEIVER_READ_ONLY_TBSIG_RECEIVER_ADDED_WHO",
column: x => x.ADDED_WHO,
principalSchema: "dbo",
principalTable: "TBSIG_RECEIVER",
principalColumn: "EMAIL_ADDRESS",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_TBDD_GROUPS_USER_GROUP_ID",
schema: "dbo",
table: "TBDD_GROUPS_USER",
column: "GROUP_ID");
migrationBuilder.CreateIndex(
name: "IX_TBDD_GROUPS_USER_USER_ID",
schema: "dbo",
table: "TBDD_GROUPS_USER",
column: "USER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_MODULES_MODULE_ID",
schema: "dbo",
table: "TBDD_USER_MODULES",
column: "MODULE_ID");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_MODULES_USER_ID",
schema: "dbo",
table: "TBDD_USER_MODULES",
column: "USER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_REPRESENTATION_GROUP_ID",
schema: "dbo",
table: "TBDD_USER_REPRESENTATION",
column: "GROUP_ID");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_REPRESENTATION_REPR_GROUP",
schema: "dbo",
table: "TBDD_USER_REPRESENTATION",
column: "REPR_GROUP");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_REPRESENTATION_REPR_USER",
schema: "dbo",
table: "TBDD_USER_REPRESENTATION",
column: "REPR_USER");
migrationBuilder.CreateIndex(
name: "IX_TBDD_USER_REPRESENTATION_USER_ID",
schema: "dbo",
table: "TBDD_USER_REPRESENTATION",
column: "USER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_DOCUMENT_RECEIVER_ELEMENT_DOCUMENT_ID",
schema: "dbo",
table: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
column: "DOCUMENT_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_DOCUMENT_RECEIVER_ELEMENT_RECEIVER_ID",
schema: "dbo",
table: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
column: "RECEIVER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_DOCUMENT_STATUS_ENVELOPE_ID",
schema: "dbo",
table: "TBSIG_DOCUMENT_STATUS",
column: "ENVELOPE_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_DOCUMENT_STATUS_RECEIVER_ID",
schema: "dbo",
table: "TBSIG_DOCUMENT_STATUS",
column: "RECEIVER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_ENVELOPE_TYPE",
schema: "dbo",
table: "TBSIG_ENVELOPE",
column: "ENVELOPE_TYPE");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_USER_ID",
schema: "dbo",
table: "TBSIG_ENVELOPE",
column: "USER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_DOCUMENT_ENVELOPE_ID",
schema: "dbo",
table: "TBSIG_ENVELOPE_DOCUMENT",
column: "ENVELOPE_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_HISTORY_ENVELOPE_ID",
schema: "dbo",
table: "TBSIG_ENVELOPE_HISTORY",
column: "ENVELOPE_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_HISTORY_ReceiverId",
schema: "dbo",
table: "TBSIG_ENVELOPE_HISTORY",
column: "ReceiverId");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_HISTORY_SenderId",
schema: "dbo",
table: "TBSIG_ENVELOPE_HISTORY",
column: "SenderId");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_RECEIVER_RECEIVER_ID",
schema: "dbo",
table: "TBSIG_ENVELOPE_RECEIVER",
column: "RECEIVER_ID");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_ENVELOPE_RECEIVER_READ_ONLY_ADDED_WHO",
table: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY",
column: "ADDED_WHO");
migrationBuilder.CreateIndex(
name: "IX_TBSIG_RECEIVER_EnvelopeId",
schema: "dbo",
table: "TBSIG_RECEIVER",
column: "EnvelopeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TBDD_CLIENT_USER",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBDD_GROUPS_USER",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBDD_USER_MODULES",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBDD_USER_REPRESENTATION",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBEMLP_EMAIL_OUT");
migrationBuilder.DropTable(
name: "TBSIG_CONFIG",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_DOCUMENT_STATUS",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_EMAIL_TEMPLATE",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_CERTIFICATE",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_HISTORY",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_RECEIVER",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY");
migrationBuilder.DropTable(
name: "TBDD_MODULES",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBDD_GROUPS",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_DOCUMENT",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_RECEIVER",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBDD_USER",
schema: "dbo");
migrationBuilder.DropTable(
name: "TBSIG_ENVELOPE_TYPE",
schema: "dbo");
}
}
}
#endif

View File

@@ -2,11 +2,12 @@
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Infrastructure.Repositories;
[Obsolete("Use IRepository")]
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbContext>, IEnvelopeTypeRepository
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeTypeDefaults, EnvelopeType, EGDbContext>, IEnvelopeTypeRepository
{
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
{

View File

@@ -81,8 +81,10 @@
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_EnvelopeType", "Hilfe zum Feld Umschlagtyp")' />
</MudTooltip>
</label>
<select value="@(_selectedEnvelopeTypeId?.ToString() ?? string.Empty)"
@onchange="OnEnvelopeTypeChanged"
<select id="wizard-envelope-type"
name="wizard-envelope-type"
@bind="_selectedEnvelopeType"
@bind:after="OnEnvelopeTypeChanged"
class="sender-create-wizard__select">
@foreach (var type in EnvelopeTypes)
{
@@ -117,7 +119,10 @@
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_Language", "Hilfe zum Feld Sprache")' />
</MudTooltip>
</label>
<select @bind="_language" class="sender-create-wizard__select">
<select id="wizard-language"
name="wizard-language"
@bind="_language"
class="sender-create-wizard__select">
<option value="de-DE">Deutsch (de-DE)</option>
<option value="en-US">English (en-US)</option>
<option value="de">Deutsch (de)</option>
@@ -141,19 +146,6 @@
</div>
<div class="sender-create-wizard__form-grid">
<div class="sender-create-wizard__field">
<label class="sender-create-wizard__label sender-create-wizard__label-row">
<span>@L("CertificationType", "Zertifizierung")</span>
<MudTooltip Text='@L("SenderWizard_Help_CertificationType", "Bestimmt das Signaturniveau fuer diesen Umschlag.")'>
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_CertificationType", "Hilfe zum Feld Zertifizierung")' />
</MudTooltip>
</label>
<select @bind="_certificationType" @bind:after="OnCertificationTypeChanged" class="sender-create-wizard__select">
<option value="@CertificationType.AdvancedElectronicSignature">@L("AdvancedElectronicSignature", "Advanced Electronic Signature")</option>
<option value="@CertificationType.ElectronicSignature">@L("ElectronicSignature", "Electronic Signature")</option>
</select>
</div>
<div class="sender-create-wizard__field">
<label class="sender-create-wizard__label sender-create-wizard__label-row">
<span>@L("FinalEmailToCreator", "Abgeschlossenes Dokument an Ersteller")</span>
@@ -161,10 +153,14 @@
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_FinalEmailToCreator", "Hilfe zum Feld Abgeschlossenes Dokument an Ersteller")' />
</MudTooltip>
</label>
<select @bind="_finalEmailToCreator" class="sender-create-wizard__select">
<option value="0">@L("No", "Nein")</option>
<option value="1">@L("Yes", "Ja")</option>
<option value="2">@L("YesWithAttachment", "Ja, mit Anhang")</option>
<select id="wizard-final-email-to-creator"
name="wizard-final-email-to-creator"
@bind="_finalEmailToCreator"
@bind:after="OnFinalEmailToCreatorChanged"
class="sender-create-wizard__select">
<option value="@FinalEmailType.No">@L("No", "Nein")</option>
<option value="@FinalEmailType.Yes">@L("Yes", "Ja")</option>
<option value="@FinalEmailType.YesWithAttachment">@L("YesWithAttachment", "Ja, mit Anhang")</option>
</select>
</div>
@@ -175,17 +171,21 @@
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_FinalEmailToReceivers", "Hilfe zum Feld Abgeschlossenes Dokument an Empfaenger")' />
</MudTooltip>
</label>
<select @bind="_finalEmailToReceivers" class="sender-create-wizard__select">
<option value="0">@L("No", "Nein")</option>
<option value="1">@L("Yes", "Ja")</option>
<option value="2">@L("YesWithAttachment", "Ja, mit Anhang")</option>
<select id="wizard-final-email-to-receivers"
name="wizard-final-email-to-receivers"
@bind="_finalEmailToReceivers"
@bind:after="OnFinalEmailToReceiversChanged"
class="sender-create-wizard__select">
<option value="@FinalEmailType.No">@L("No", "Nein")</option>
<option value="@FinalEmailType.Yes">@L("Yes", "Ja")</option>
<option value="@FinalEmailType.YesWithAttachment">@L("YesWithAttachment", "Ja, mit Anhang")</option>
</select>
</div>
<div class="sender-create-wizard__field sender-create-wizard__field--full">
<div class="sender-create-wizard__settings-toggles">
<label class="sender-create-wizard__settings-toggle">
<input type="checkbox" checked="@_tfaEnabled" @onchange="OnTfaChanged" disabled="@IsFesSelected" />
<input type="checkbox" checked="@_tfaEnabled" @onchange="OnTfaChanged" disabled="@(_selectedEnvelopeType == EnvelopeType.AdvancedSignature)" />
<span>@L("TFAEnabled", "2FA aktiviert")</span>
<MudTooltip Text='@L("SenderWizard_Help_TfaEnabled", "Wenn aktiviert, ist die Signaturfreigabe nur mit zusaetzlicher Verifizierung moeglich.")'>
<MudIconButton Icon="@Icons.Material.Filled.Info" Color="Color.Tertiary" Size="Size.Small" Class="sender-create-wizard__help-icon" aria-label='@L("SenderWizard_HelpAria_TfaEnabled", "Hilfe zur Option 2FA")' />
@@ -436,7 +436,7 @@
public EventCallback<CreateEnvelopeWizardResult> StartEditorRequested { get; set; }
[Parameter]
public IReadOnlyList<EnvelopeTypeDto> EnvelopeTypes { get; set; } = [];
public IReadOnlyList<EnvelopeTypeDefaultsDto> EnvelopeTypes { get; set; } = [];
private const int TotalSteps = 4;
private static readonly System.ComponentModel.DataAnnotations.EmailAddressAttribute EmailValidator = new();
@@ -447,14 +447,15 @@
private readonly HashSet<int> _completedSteps = [];
private string _title = string.Empty;
private int? _selectedEnvelopeTypeId;
private EnvelopeType? _selectedEnvelopeType;
private string _message = string.Empty;
private string _language = "de-DE";
private bool _useAccessCode;
private bool _tfaEnabled;
private CertificationType _certificationType = CertificationType.AdvancedElectronicSignature;
private int _finalEmailToCreator = (int)FinalEmailType.No;
private int _finalEmailToReceivers = (int)FinalEmailType.No;
private FinalEmailType _finalEmailToCreator = FinalEmailType.No;
private FinalEmailType _finalEmailToReceivers = FinalEmailType.No;
private bool _finalEmailToCreatorUserOverridden;
private bool _finalEmailToReceiversUserOverridden;
private bool _sendReminderEmails;
private int _firstReminderDays;
private int _reminderIntervalDays;
@@ -481,7 +482,6 @@
private string? _validationMessage;
private bool IsActionLocked => _isDocumentUploading || _isStepActionRunning || _isFinishing;
private bool IsFesSelected => _certificationType == CertificationType.AdvancedElectronicSignature;
private bool IsFirstStep => _currentStep <= 0;
private bool IsLastStep => _currentStep >= TotalSteps - 1;
@@ -510,7 +510,7 @@
{
_isVisible = Visible;
if (_selectedEnvelopeTypeId is null && EnvelopeTypes.Count > 0)
if (_selectedEnvelopeType is null && EnvelopeTypes.Count > 0)
ApplyDefaultEnvelopeType();
if (Visible && !_previousVisible)
@@ -554,21 +554,30 @@
return Task.CompletedTask;
}
private Task OnEnvelopeTypeChanged(ChangeEventArgs args)
private Task OnEnvelopeTypeChanged()
{
_validationMessage = null;
var raw = args.Value?.ToString();
if (int.TryParse(raw, out var id) && id > 0)
if (_selectedEnvelopeType is not null)
{
_selectedEnvelopeTypeId = id;
var selectedType = EnvelopeTypes.FirstOrDefault(x => x.Id == id);
var selectedType = EnvelopeTypes.FirstOrDefault(x => x.Id == _selectedEnvelopeType.Value);
if (selectedType is not null)
ApplyEnvelopeTypeDefaults(selectedType);
return Task.CompletedTask;
}
_selectedEnvelopeTypeId = null;
return Task.CompletedTask;
}
private Task OnFinalEmailToCreatorChanged()
{
_validationMessage = null;
_finalEmailToCreatorUserOverridden = true;
return Task.CompletedTask;
}
private Task OnFinalEmailToReceiversChanged()
{
_validationMessage = null;
_finalEmailToReceiversUserOverridden = true;
return Task.CompletedTask;
}
@@ -771,11 +780,10 @@
var result = new CreateEnvelopeWizardResult(
Title: _title.Trim(),
Message: _message.Trim(),
EnvelopeTypeId: _selectedEnvelopeTypeId,
Type: _selectedEnvelopeType,
Language: string.IsNullOrWhiteSpace(_language) ? "de-DE" : _language,
UseAccessCode: _useAccessCode,
TFAEnabled: _tfaEnabled,
CertificationType: _certificationType,
FinalEmailToCreator: _finalEmailToCreator,
FinalEmailToReceivers: _finalEmailToReceivers,
SendReminderEmails: _sendReminderEmails,
@@ -880,8 +888,8 @@
{
if (_currentStep == 0)
{
if (_selectedEnvelopeTypeId is null && EnvelopeTypes.Count > 0)
_selectedEnvelopeTypeId = GetDefaultEnvelopeTypeId();
if (_selectedEnvelopeType is null && EnvelopeTypes.Count > 0)
_selectedEnvelopeType = EnvelopeType.SimpleSignature;
if (string.IsNullOrWhiteSpace(_title))
{
@@ -889,7 +897,7 @@
return false;
}
if (!_selectedEnvelopeTypeId.HasValue || _selectedEnvelopeTypeId.Value <= 0)
if (!_selectedEnvelopeType.HasValue || _selectedEnvelopeType.Value <= 0)
{
_validationMessage = L("SenderWizard_Validation_EnvelopeTypeRequired", "Bitte wählen Sie einen Umschlagtyp aus.");
return false;
@@ -976,7 +984,7 @@
{
_validationMessage = null;
if (IsFesSelected)
if (_selectedEnvelopeType == EnvelopeType.AdvancedSignature)
{
_tfaEnabled = true;
_useAccessCode = true;
@@ -988,13 +996,6 @@
_useAccessCode = true;
}
private Task OnCertificationTypeChanged()
{
_validationMessage = null;
NormalizeSettings();
return Task.CompletedTask;
}
private void OnUseAccessCodeChanged(ChangeEventArgs args)
{
_validationMessage = null;
@@ -1022,7 +1023,7 @@
return bool.TryParse(args.Value?.ToString(), out var parsed) && parsed;
}
private void ApplyEnvelopeTypeDefaults(EnvelopeTypeDto envelopeType)
private void ApplyEnvelopeTypeDefaults(EnvelopeTypeDefaultsDto envelopeType)
{
if (!string.IsNullOrWhiteSpace(envelopeType.Language))
_language = envelopeType.Language;
@@ -1033,15 +1034,14 @@
if (_tfaEnabled)
_useAccessCode = true;
if (envelopeType.CertificationType.HasValue)
_certificationType = envelopeType.CertificationType.Value;
if (envelopeType.FinalEmailToCreator.HasValue)
if (envelopeType.FinalEmailToCreator.HasValue && !_finalEmailToCreatorUserOverridden)
_finalEmailToCreator = envelopeType.FinalEmailToCreator.Value;
if (envelopeType.FinalEmailToReceivers.HasValue)
if (envelopeType.FinalEmailToReceivers.HasValue && !_finalEmailToReceiversUserOverridden)
_finalEmailToReceivers = envelopeType.FinalEmailToReceivers.Value;
ApplyEnvelopeTypeFinalEmailDefaults(envelopeType.Id);
if (envelopeType.SendReminderEmails.HasValue)
_sendReminderEmails = envelopeType.SendReminderEmails.Value;
@@ -1060,11 +1060,31 @@
NormalizeSettings();
}
private void ApplyEnvelopeTypeFinalEmailDefaults(EnvelopeType envelopeType)
{
if ((envelopeType == EnvelopeType.SimpleSignature || envelopeType == EnvelopeType.AdvancedSignature)
&& !_finalEmailToCreatorUserOverridden)
{
_finalEmailToCreator = FinalEmailType.YesWithAttachment;
}
if (envelopeType == EnvelopeType.ReadAndConfirm && !_finalEmailToCreatorUserOverridden)
_finalEmailToCreator = FinalEmailType.Yes;
if ((envelopeType == EnvelopeType.SimpleSignature
|| envelopeType == EnvelopeType.AdvancedSignature
|| envelopeType == EnvelopeType.ReadAndConfirm)
&& !_finalEmailToReceiversUserOverridden)
{
_finalEmailToReceivers = FinalEmailType.YesWithAttachment;
}
}
private void NormalizeSettings()
{
_language = string.IsNullOrWhiteSpace(_language) ? "de-DE" : _language.Trim();
if (IsFesSelected)
if (_selectedEnvelopeType == EnvelopeType.AdvancedSignature)
_tfaEnabled = true;
if (_tfaEnabled)
@@ -1107,11 +1127,11 @@
private void ApplyDefaultEnvelopeType()
{
_selectedEnvelopeTypeId = GetDefaultEnvelopeTypeId();
if (!_selectedEnvelopeTypeId.HasValue)
_selectedEnvelopeType = EnvelopeType.SimpleSignature;
if (!_selectedEnvelopeType.HasValue)
return;
var selectedType = EnvelopeTypes.FirstOrDefault(x => x.Id == _selectedEnvelopeTypeId.Value);
var selectedType = EnvelopeTypes.FirstOrDefault(x => x.Id == _selectedEnvelopeType);
if (selectedType is not null)
ApplyEnvelopeTypeDefaults(selectedType);
}
@@ -1123,14 +1143,15 @@
_validationMessage = null;
_title = string.Empty;
_selectedEnvelopeTypeId = null;
_selectedEnvelopeType = null;
_message = string.Empty;
_language = "de-DE";
_useAccessCode = false;
_tfaEnabled = false;
_certificationType = CertificationType.AdvancedElectronicSignature;
_finalEmailToCreator = (int)FinalEmailType.No;
_finalEmailToReceivers = (int)FinalEmailType.No;
_finalEmailToCreator = FinalEmailType.No;
_finalEmailToReceivers = FinalEmailType.No;
_finalEmailToCreatorUserOverridden = false;
_finalEmailToReceiversUserOverridden = false;
_sendReminderEmails = false;
_firstReminderDays = 0;
_reminderIntervalDays = 0;
@@ -1153,18 +1174,6 @@
NormalizeSettings();
}
private int? GetDefaultEnvelopeTypeId()
{
if (EnvelopeTypes.Count == 0)
return null;
var handwrittenType = EnvelopeTypes.FirstOrDefault(x =>
!string.IsNullOrWhiteSpace(x.Title)
&& x.Title.Contains("Handschriftliche Unterschrift", StringComparison.OrdinalIgnoreCase));
return handwrittenType?.Id ?? EnvelopeTypes[0].Id;
}
private string L(string key, string fallback)
{
var modelValue = ModelLocalizer[key];

View File

@@ -5,13 +5,12 @@ namespace EnvelopeGenerator.Server.Client.Components.Sender;
public sealed record CreateEnvelopeWizardResult(
string Title,
string Message,
int? EnvelopeTypeId,
EnvelopeType? Type,
string Language,
bool UseAccessCode,
bool TFAEnabled,
CertificationType CertificationType,
int FinalEmailToCreator,
int FinalEmailToReceivers,
FinalEmailType FinalEmailToCreator,
FinalEmailType FinalEmailToReceivers,
bool SendReminderEmails,
int FirstReminderDays,
int ReminderIntervalDays,

View File

@@ -22,7 +22,7 @@
</main>
<footer class="receiver-footer">
<div class="receiver-footer__left">
<span>&copy; signFLOW 2023-2024 <a href="https://digitaldata.works" target="_blank" rel="noopener">Digital Data GmbH</a></span>
<span>&copy; @DateTime.Now.Year <a href="https://digitaldata.works" target="_blank" rel="noopener">Digital Data GmbH</a></span>
<span class="receiver-footer__sep">&#124;</span>
<a href="@GetPrivacyPolicyPath()" target="_blank" rel="noopener">@L("PrivacyPolicy", "Datenschutz")</a>
</div>

View File

@@ -1,3 +1,5 @@
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Server.Client.Models;
/// <summary>
@@ -38,10 +40,8 @@ public record EnvelopeClientDto
public DateTime AddedWhen { get; init; }
public DateTime? ChangedWhen { get; init; }
public string Language { get; init; } = "de-DE";
public int? EnvelopeTypeId { get; init; }
public EnvelopeType? Type { get; init; }
public string? EnvelopeTypeTitle { get; init; }
public int? ContractType { get; init; }
public int? CertificationType { get; init; }
public bool UseAccessCode { get; init; }
public bool TFAEnabled { get; init; }
public IEnumerable<DocumentClientDto>? Documents { get; init; }

View File

@@ -1,6 +1,7 @@
@page "/envelope/login/{EnvelopeKey}"
@rendermode InteractiveWebAssembly
@using EnvelopeGenerator.Server.Client.Services
@using EnvelopeGenerator.Application.EnvelopeReceivers.Commands
@using EnvelopeGenerator.Application.Resources
@using Microsoft.Extensions.Localization
@inject AuthService AuthService
@@ -22,9 +23,11 @@
<div class="card-body p-4">
<p class="text-muted mb-4" style="font-size: 0.875rem; line-height: 1.5;">
@L("ReceiverLogin_Description", "Bitte geben Sie den Zugangscode ein, den Sie per E-Mail erhalten haben, um das Dokument sicher zu öffnen.")
</p>
<div class="text-muted mb-4" style="font-size: 0.875rem; line-height: 1.5;">
<p class="mb-2 fw-semibold text-dark">@L("ReceiverLogin_InfoTitle", "Sicherheit ist uns wichtig.")</p>
<p class="mb-2">@L("ReceiverLogin_InfoStep1", "Direkt nachdem Sie den Link zum Unterzeichnen geöffnet haben, haben wir Ihnen eine zweite E-Mail gesendet.")</p>
<p class="mb-0">@L("ReceiverLogin_InfoStep2", "Darin finden Sie den Zugangscode, den Sie hier eingeben müssen.")</p>
</div>
@if (LoginResult == EnvelopeLoginResult.NotFound)
{
@@ -109,6 +112,33 @@
</div>
</div>
<div class="mb-3">
<span class="text-muted" style="font-size:0.85rem;">@L("ReceiverLogin_ResendPrompt", "Zugangscode nicht bekommen?")</span>
<DxButton Text="@(IsResending ? L("ReceiverLogin_ResendInProgress", "Code wird gesendet ...") : L("ReceiverLogin_ResendAction", "Code erneut senden"))"
RenderStyle="ButtonRenderStyle.Link"
Click="ResendAccessCodeAsync"
Enabled="@(!IsLoading && !IsResending)" />
</div>
@if (ResendResult == SendAccessCodeResult.Sent)
{
<div class="alert alert-success py-2" role="alert" style="font-size:0.85rem;">
@L("ReceiverLogin_ResendSuccess", "Wir haben Ihnen soeben einen neuen Zugangscode per E-Mail gesendet.")
</div>
}
else if (ResendResult == SendAccessCodeResult.RequestLimitExceeded)
{
<div class="alert alert-warning py-2" role="alert" style="font-size:0.85rem;">
@L("ReceiverLogin_ResendRateLimit", "Sie haben soeben einen Code angefordert. Bitte warten Sie kurz und versuchen Sie es erneut.")
</div>
}
else if (ResendRequestFailed)
{
<div class="alert alert-secondary py-2" role="alert" style="font-size:0.85rem;">
@L("ReceiverLogin_ResendError", "Der Zugangscode konnte nicht erneut gesendet werden. Bitte versuchen Sie es später erneut.")
</div>
}
<button class="btn btn-primary w-100 py-2 fw-medium"
style="background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%); border: none;"
@onclick="SubmitAsync"
@@ -142,14 +172,22 @@
string AccessCode = string.Empty;
bool ShowCode;
bool IsLoading;
bool IsResending;
bool ResendRequestFailed;
EnvelopeLoginResult? LoginResult;
SendAccessCodeResult? ResendResult;
protected override async Task OnInitializedAsync()
{
if (string.IsNullOrWhiteSpace(EnvelopeKey))
return;
_ = await AuthService.RequestEnvelopeReceiverAccessCodeAsync(EnvelopeKey);
var requestResult = await AuthService.RequestEnvelopeReceiverAccessCodeAsync(EnvelopeKey, autoGenerated: true);
if (requestResult == SendAccessCodeResult.AlreadySigned)
{
Navigation.NavigateTo("/envelope/signed-result", forceLoad: false);
return;
}
}
async Task OnKeyDownAsync(Microsoft.AspNetCore.Components.Web.KeyboardEventArgs e)
@@ -179,6 +217,29 @@
await InvokeAsync(StateHasChanged);
}
async Task ResendAccessCodeAsync()
{
if (IsLoading || IsResending || string.IsNullOrWhiteSpace(EnvelopeKey))
return;
IsResending = true;
ResendRequestFailed = false;
ResendResult = null;
await InvokeAsync(StateHasChanged);
var result = await AuthService.RequestEnvelopeReceiverAccessCodeAsync(EnvelopeKey, autoGenerated: false);
if (result == SendAccessCodeResult.AlreadySigned)
{
Navigation.NavigateTo("/envelope/signed-result", forceLoad: false);
return;
}
ResendResult = result;
ResendRequestFailed = result is null;
IsResending = false;
await InvokeAsync(StateHasChanged);
}
string L(string key, string fallback)
{
var value = UiLocalizer[key];

View File

@@ -6,137 +6,161 @@
@inject AuthService AuthService
@inject NavigationManager Navigation
@inject IStringLocalizer<Resource> UiLocalizer
@inject CustomImagesService CustomImagesService
<div class="login-page-wrapper d-flex align-items-center justify-content-center min-vh-100">
<div class="login-card card shadow border-0" style="max-width: 440px; width: 100%;">
<div class="sender-login-page d-flex align-items-center justify-content-center min-vh-100">
<div class="sender-login-content">
<div class="login-card sender-login-card card shadow border-0" style="max-width: 440px; width: 100%;">
<div class="card-header text-white text-center py-4 border-0" style="background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%); border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;">
<div class="mb-2">
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
</svg>
</div>
<h5 class="mb-0 fw-semibold">@L("SenderLogin_Title", "Sender Anmeldung")</h5>
<p class="mb-0 mt-1 opacity-75" style="font-size: 0.85rem;">@L("SenderLogin_Subtitle", "Sicherer Zugang zum Sender-Dashboard")</p>
</div>
<div class="card-body p-4">
<p class="text-muted mb-4" style="font-size: 0.875rem; line-height: 1.5;">
@L("SenderLogin_Description", "Bitte melden Sie sich mit Ihren Zugangsdaten an, um auf das Sender-Dashboard zuzugreifen.")
</p>
@if (LoginResult == SenderLoginResult.InvalidCredentials) {
<div class="alert alert-danger d-flex align-items-start gap-2 py-2" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="flex-shrink-0 mt-1" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"/>
</svg>
<div>
<strong>@L("SenderLogin_InvalidCredentials_Title", "Ungültige Anmeldedaten.")</strong><br />
<span style="font-size:0.85rem;">@L("SenderLogin_InvalidCredentials_Body", "Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.")</span>
</div>
</div>
} else if (LoginResult == SenderLoginResult.Error) {
<div class="alert alert-secondary d-flex align-items-start gap-2 py-2" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="flex-shrink-0 mt-1" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/>
</svg>
<div>
<strong>@L("ServerError", "Serverfehler.")</strong><br />
<span style="font-size:0.85rem;">@L("UnexpectedErrorTryAgainLater", "Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.")</span>
</div>
</div>
}
<div class="mb-3">
<label class="form-label fw-medium" for="login-username">
@L("UserName", "Benutzername")
<span class="text-danger ms-1">*</span>
</label>
<div class="input-group">
<span class="input-group-text bg-light">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/>
<div class="card-header text-white text-center py-4 border-0" style="border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;">
<div class="mb-2">
@if (_appLogo is not null && !string.IsNullOrEmpty(_appLogo.Src))
{
<img src="@_appLogo.Src"
style="height: @_appLogo.Height"
class="@_appLogo.GetClass("Main")"
alt="signFLOW" />
}
else
{
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="currentColor" viewBox="0 0 16 16">
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1H2Zm13 2.383-4.708 2.825L15 11.105V5.383Zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741ZM1 11.105l4.708-2.897L1 5.383v5.722Z"/>
</svg>
</span>
<input id="login-username"
type="text"
class="form-control @(LoginResult == SenderLoginResult.InvalidCredentials ? "is-invalid" : null)"
placeholder="@L("SenderLogin_Username_Placeholder", "Benutzername eingeben")"
@bind="Username"
@bind:event="oninput"
@onkeydown="OnKeyDownAsync"
disabled="@IsLoading"
autocomplete="username" />
}
</div>
<h5 class="mb-0 fw-semibold">@L("SenderLogin_Title", "Anmeldung")</h5>
<p class="mb-0 mt-1 opacity-75" style="font-size: 0.85rem;">@L("SenderLogin_Subtitle", "Dokumente zur Unterschrift vorbereiten und versenden")</p>
</div>
<div class="mb-4">
<label class="form-label fw-medium" for="login-password">
@L("Password", "Passwort")
<span class="text-danger ms-1">*</span>
</label>
<div class="input-group">
<span class="input-group-text bg-light border-end-0">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" viewBox="0 0 16 16">
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
<div class="card-body p-4">
<a class="sender-login-back-link" href="/">@L("SenderLogin_BackToHome", "← Zurück zur Startseite")</a>
<p class="text-muted mb-4 mt-3" style="font-size: 0.875rem; line-height: 1.5;">
@L("SenderLogin_Description", "Melden Sie sich mit denselben Zugangsdaten an wie an Ihrem Arbeitsplatz-PC.")
</p>
@if (ShowRequiredValidation && (string.IsNullOrWhiteSpace(Username) || string.IsNullOrWhiteSpace(Password)))
{
<div class="alert alert-warning d-flex align-items-start gap-2 py-2" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="flex-shrink-0 mt-1" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</svg>
</span>
<input id="login-password"
type="@(ShowPassword ? "text" : "password")"
class="form-control border-start-0 border-end-0 @(LoginResult == SenderLoginResult.InvalidCredentials ? "is-invalid" : null)"
placeholder="@L("SenderLogin_Password_Placeholder", "Passwort eingeben")"
@bind="Password"
@bind:event="oninput"
@onkeydown="OnKeyDownAsync"
disabled="@IsLoading"
autocomplete="current-password" />
<button type="button"
class="btn btn-outline-secondary border-start-0"
style="border-left: none;"
tabindex="-1"
@onclick="() => ShowPassword = !ShowPassword">
@if (ShowPassword) {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
<path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
<path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709z"/>
<path fill-rule="evenodd" d="M13.646 14.354l-12-12 .708-.708 12 12-.708.708z"/>
</svg>
<div>
<strong>@L("SenderLogin_RequiredFields_Title", "Pflichtfelder fehlen.")</strong><br />
<span style="font-size:0.85rem;">@L("SenderLogin_RequiredFields_Body", "Bitte Benutzername und Passwort eingeben.")</span>
</div>
</div>
}
@if (LoginResult == SenderLoginResult.InvalidCredentials) {
<div class="alert alert-danger d-flex align-items-start gap-2 py-2" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="flex-shrink-0 mt-1" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"/>
</svg>
<div>
<strong>@L("SenderLogin_InvalidCredentials_Title", "Ungültige Anmeldedaten.")</strong><br />
<span style="font-size:0.85rem;">@L("SenderLogin_InvalidCredentials_Body", "Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.")</span>
</div>
</div>
} else if (LoginResult == SenderLoginResult.Error) {
<div class="alert alert-secondary d-flex align-items-start gap-2 py-2" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="flex-shrink-0 mt-1" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/>
</svg>
<div>
<strong>@L("ServerError", "Serverfehler.")</strong><br />
<span style="font-size:0.85rem;">@L("UnexpectedErrorTryAgainLater", "Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.")</span>
</div>
</div>
}
<form @onsubmit="SubmitFormAsync">
<div class="mb-3">
<label class="form-label fw-medium" for="login-username">
@L("UserName", "Benutzername")
</label>
<div class="input-group">
<span class="input-group-text bg-light">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/>
</svg>
</span>
<input id="login-username"
type="text"
class="form-control @GetUsernameInputClass()"
placeholder="@L("SenderLogin_Username_Placeholder", "z. B. m.mustermann")"
@bind="Username"
@bind:event="oninput"
disabled="@IsLoading"
autocomplete="username"
autofocus
@ref="UsernameInputRef" />
</div>
</div>
<div class="mb-4">
<label class="form-label fw-medium" for="login-password">
@L("Password", "Passwort")
</label>
<div class="input-group">
<span class="input-group-text bg-light">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#6c757d" viewBox="0 0 16 16">
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
</svg>
</span>
<input id="login-password"
type="@(ShowPassword ? "text" : "password")"
class="form-control @GetPasswordInputClass()"
@bind="Password"
@bind:event="oninput"
disabled="@IsLoading"
autocomplete="current-password" />
<button type="button"
class="btn btn-outline-secondary"
style="margin-left: 0;"
tabindex="-1"
@onclick="() => ShowPassword = !ShowPassword">
@if (ShowPassword) {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
<path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
<path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709z"/>
<path fill-rule="evenodd" d="M13.646 14.354l-12-12 .708-.708 12 12-.708.708z"/>
</svg>
} else {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
}
</button>
</div>
</div>
<button type="submit"
class="btn home-btn-primary w-100 py-2 fw-medium"
disabled="@IsLoading">
@if (IsLoading) {
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
<span>@L("LoginInProgress", "Anmelden …")</span>
} else {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="me-2" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
<path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/>
</svg>
<span>@L("Login", "Anmelden")</span>
}
</button>
</div>
</form>
</div>
<button class="btn btn-primary w-100 py-2 fw-medium"
style="background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%); border: none;"
@onclick="SubmitAsync"
disabled="@(IsLoading || string.IsNullOrWhiteSpace(Username) || string.IsNullOrWhiteSpace(Password))">
@if (IsLoading) {
<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>
<span>@L("LoginInProgress", "Anmelden …")</span>
} else {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="me-2" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/>
<path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/>
</svg>
<span>@L("Login", "Anmelden")</span>
}
</button>
<div class="card-footer text-center text-muted py-3 border-0 bg-transparent" style="font-size: 0.78rem;">
&copy; @DateTime.Now.Year Digital Data GmbH
</div>
</div>
<div class="card-footer text-center text-muted py-3 border-0 bg-transparent" style="font-size: 0.78rem;">
@L("SenderLogin_FooterHelp", "Bei Problemen wenden Sie sich bitte an den Administrator.")
</div>
</div>
</div>
@@ -145,17 +169,42 @@
string Password = string.Empty;
bool ShowPassword;
bool IsLoading;
bool ShowRequiredValidation;
SenderLoginResult? LoginResult;
ElementReference UsernameInputRef;
EnvelopeGenerator.Server.Client.Services.CustomImageDto? _appLogo;
async Task OnKeyDownAsync(Microsoft.AspNetCore.Components.Web.KeyboardEventArgs e) {
if (e.Key == "Enter")
await SubmitAsync();
protected override async Task OnInitializedAsync()
{
var logos = await CustomImagesService.GetAsync();
_appLogo = logos.App;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
return;
await UsernameInputRef.FocusAsync();
}
async Task SubmitFormAsync()
{
await SubmitAsync();
}
async Task SubmitAsync() {
if (string.IsNullOrWhiteSpace(Username) || string.IsNullOrWhiteSpace(Password) || IsLoading) return;
if (IsLoading) return;
if (string.IsNullOrWhiteSpace(Username) || string.IsNullOrWhiteSpace(Password)) {
ShowRequiredValidation = true;
LoginResult = null;
await InvokeAsync(StateHasChanged);
return;
}
IsLoading = true;
ShowRequiredValidation = false;
LoginResult = null;
await InvokeAsync(StateHasChanged);
@@ -171,6 +220,20 @@
await InvokeAsync(StateHasChanged);
}
string GetUsernameInputClass()
{
if (LoginResult == SenderLoginResult.InvalidCredentials)
return "is-invalid";
return ShowRequiredValidation && string.IsNullOrWhiteSpace(Username) ? "is-invalid" : string.Empty;
}
string GetPasswordInputClass()
{
if (LoginResult == SenderLoginResult.InvalidCredentials)
return "is-invalid";
return ShowRequiredValidation && string.IsNullOrWhiteSpace(Password) ? "is-invalid" : string.Empty;
}
string L(string key, string fallback)
{
var value = UiLocalizer[key];

View File

@@ -13,6 +13,7 @@
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@using EnvelopeGenerator.Domain.Interfaces
@inject IJSRuntime JSRuntime
@inject NavigationManager NavigationManager
@inject AppVersionService AppVersion
@@ -99,7 +100,7 @@
<div class="sender-settings-grid">
<div class="sender-settings-field">
<label class="sender-settings-label">@L("EnvelopeType", "Umschlagtyp")</label>
<select value="@(_selectedEnvelopeTypeId?.ToString() ?? string.Empty)"
<select value="@(_selectedType?.ToString() ?? string.Empty)"
@onchange="OnEnvelopeTypeChanged"
class="sender-settings-select">
<option value="">@L("SenderEditor_SelectTemplate", "Vorlage auswählen")</option>
@@ -120,14 +121,6 @@
</select>
</div>
<div class="sender-settings-field">
<label class="sender-settings-label">@L("CertificationType", "Zertifizierung")</label>
<select @bind="_certificationType" class="sender-settings-select">
<option value="@CertificationType.AdvancedElectronicSignature">@L("AdvancedElectronicSignature", "Advanced Electronic Signature")</option>
<option value="@CertificationType.ElectronicSignature">@L("ElectronicSignature", "Electronic Signature")</option>
</select>
</div>
<div class="sender-settings-toggles">
<label class="sender-settings-toggle">
<input type="checkbox" checked="@_tfaEnabled" @onchange="OnTfaChanged" />
@@ -141,19 +134,25 @@
<div class="sender-settings-field">
<label class="sender-settings-label">@L("FinalEmailToCreator", "Finale E-Mail an Ersteller")</label>
<select @bind="_finalEmailToCreator" class="sender-settings-select">
<option value="0">@L("No", "Nein")</option>
<option value="1">@L("Yes", "Ja")</option>
<option value="2">@L("YesWithAttachment", "Ja, mit Anhang")</option>
<select id="sender-editor-final-email-to-creator"
name="sender-editor-final-email-to-creator"
@bind="_finalEmailToCreator"
class="sender-settings-select">
<option value="@FinalEmailType.No">@L("No", "Nein")</option>
<option value="@FinalEmailType.Yes">@L("Yes", "Ja")</option>
<option value="@FinalEmailType.YesWithAttachment">@L("YesWithAttachment", "Ja, mit Anhang")</option>
</select>
</div>
<div class="sender-settings-field">
<label class="sender-settings-label">@L("FinalEmailToReceivers", "Finale E-Mail an Empfänger")</label>
<select @bind="_finalEmailToReceivers" class="sender-settings-select">
<option value="0">@L("No", "Nein")</option>
<option value="1">@L("Yes", "Ja")</option>
<option value="2">@L("YesWithAttachment", "Ja, mit Anhang")</option>
<select id="sender-editor-final-email-to-receivers"
name="sender-editor-final-email-to-receivers"
@bind="_finalEmailToReceivers"
class="sender-settings-select">
<option value="@FinalEmailType.No">@L("No", "Nein")</option>
<option value="@FinalEmailType.Yes">@L("Yes", "Ja")</option>
<option value="@FinalEmailType.YesWithAttachment">@L("YesWithAttachment", "Ja, mit Anhang")</option>
</select>
</div>
@@ -698,14 +697,13 @@
string _envelopeMessage = string.Empty;
bool _titleTouched = false;
List<EnvelopeTypeDto> _envelopeTypes = [];
int? _selectedEnvelopeTypeId;
List<EnvelopeTypeDefaultsDto> _envelopeTypes = [];
EnvelopeType? _selectedType;
string _language = "de-DE";
bool _useAccessCode;
bool _tfaEnabled;
CertificationType _certificationType = CertificationType.AdvancedElectronicSignature;
int _finalEmailToCreator = (int)FinalEmailType.No;
int _finalEmailToReceivers = (int)FinalEmailType.No;
FinalEmailType _finalEmailToCreator = FinalEmailType.No;
FinalEmailType _finalEmailToReceivers = FinalEmailType.No;
bool _sendReminderEmails;
int _firstReminderDays;
int _reminderIntervalDays;
@@ -786,22 +784,21 @@
_envelopeTitle = envelope.Title ?? string.Empty;
_envelopeMessage = envelope.Message ?? string.Empty;
_selectedEnvelopeTypeId = envelope.EnvelopeTypeId;
_selectedType = envelope.Type;
_language = string.IsNullOrWhiteSpace(envelope.Language) ? "de-DE" : envelope.Language;
_useAccessCode = envelope.UseAccessCode;
_tfaEnabled = envelope.TFAEnabled;
if (_tfaEnabled)
_useAccessCode = true;
_certificationType = envelope.CertificationType ?? CertificationType.AdvancedElectronicSignature;
_finalEmailToCreator = envelope.FinalEmailToCreator ?? (int)FinalEmailType.No;
_finalEmailToReceivers = envelope.FinalEmailToReceivers ?? (int)FinalEmailType.No;
_finalEmailToCreator = envelope.FinalEmailToCreator ?? FinalEmailType.No;
_finalEmailToReceivers = envelope.FinalEmailToReceivers ?? FinalEmailType.No;
_sendReminderEmails = envelope.SendReminderEmails ?? envelope.EnvelopeType?.SendReminderEmails ?? false;
_firstReminderDays = envelope.FirstReminderDays ?? envelope.EnvelopeType?.FirstReminderDays ?? 0;
_reminderIntervalDays = envelope.ReminderIntervalDays ?? envelope.EnvelopeType?.ReminderIntervalDays ?? 0;
_expiresWhenDays = envelope.ExpiresWhenDays ?? envelope.EnvelopeType?.ExpiresDays ?? 0;
_expiresWarningWhenDays = envelope.ExpiresWarningWhenDays ?? envelope.EnvelopeType?.ExpiresWarningDays ?? 0;
_sendReminderEmails = envelope.SendReminderEmails ?? envelope.Defaults?.SendReminderEmails ?? false;
_firstReminderDays = envelope.FirstReminderDays ?? envelope.Defaults?.FirstReminderDays ?? 0;
_reminderIntervalDays = envelope.ReminderIntervalDays ?? envelope.Defaults?.ReminderIntervalDays ?? 0;
_expiresWhenDays = envelope.ExpiresWhenDays ?? envelope.Defaults?.ExpiresDays ?? 0;
_expiresWarningWhenDays = envelope.ExpiresWarningWhenDays ?? envelope.Defaults?.ExpiresWarningDays ?? 0;
NormalizeSettings();
@@ -972,13 +969,15 @@
Task OnEnvelopeTypeChanged(ChangeEventArgs e)
{
var raw = e.Value?.ToString();
if (!int.TryParse(raw, out var id) || id <= 0)
if (!int.TryParse(raw, out var idInt) || idInt <= 0)
{
_selectedEnvelopeTypeId = null;
_selectedType = null;
return Task.CompletedTask;
}
_selectedEnvelopeTypeId = id;
var id = idInt.ToEnvelopeType();
_selectedType = id;
var selectedType = _envelopeTypes.FirstOrDefault(x => x.Id == id);
if (selectedType is not null)
ApplyEnvelopeTypeDefaults(selectedType);
@@ -986,7 +985,7 @@
return Task.CompletedTask;
}
void ApplyEnvelopeTypeDefaults(EnvelopeTypeDto envelopeType)
void ApplyEnvelopeTypeDefaults(EnvelopeTypeDefaultsDto envelopeType)
{
if (!string.IsNullOrWhiteSpace(envelopeType.Language))
_language = envelopeType.Language;
@@ -997,9 +996,6 @@
if (_tfaEnabled)
_useAccessCode = true;
if (envelopeType.CertificationType.HasValue)
_certificationType = envelopeType.CertificationType.Value;
if (envelopeType.FinalEmailToCreator.HasValue)
_finalEmailToCreator = envelopeType.FinalEmailToCreator.Value;
@@ -1362,13 +1358,12 @@
return new CreateEnvelopeCommand
{
EnvelopeId = envelopeId,
EnvelopeTypeId = _selectedEnvelopeTypeId,
Type = _selectedType,
Title = _envelopeTitle,
Message = _envelopeMessage,
Language = _language,
UseAccessCode = _useAccessCode,
TFAEnabled = _tfaEnabled,
CertificationType = _certificationType,
FinalEmailToCreator = _finalEmailToCreator,
FinalEmailToReceivers = _finalEmailToReceivers,
SendReminderEmails = _sendReminderEmails,

View File

@@ -626,9 +626,9 @@
private string? _deleteErrorMessage;
private bool _createWizardVisible = false;
private IReadOnlyList<EnvelopeTypeDto> _envelopeTypes = [];
private IReadOnlyList<EnvelopeTypeDefaultsDto> _envelopeTypes = [];
// Stable keys used to store/restore each tab's layout in UserPreferences.GridLayouts
// StableDefaults keys used to store/restore each tab's layout in UserPreferences.GridLayouts
private const string GridKeyActive = "sender.active-envelopes";
private const string GridKeyCompleted = "sender.completed-envelopes";
@@ -796,13 +796,12 @@
var command = new CreateEnvelopeCommand
{
EnvelopeTypeId = result.EnvelopeTypeId,
Type = result.Type,
Title = result.Title,
Message = result.Message,
Language = string.IsNullOrWhiteSpace(result.Language) ? "de-DE" : result.Language,
UseAccessCode = result.UseAccessCode,
TFAEnabled = result.TFAEnabled,
CertificationType = result.CertificationType,
FinalEmailToCreator = result.FinalEmailToCreator,
FinalEmailToReceivers = result.FinalEmailToReceivers,
SendReminderEmails = result.SendReminderEmails,

View File

@@ -1,5 +1,6 @@
using System.Net;
using System.Net.Http.Json;
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
namespace EnvelopeGenerator.Server.Client.Services;
@@ -37,14 +38,22 @@ public class AuthService(IHttpClientFactory httpClientFactory)
/// Triggers access code e-mail request flow for the receiver login page.
/// Calls POST /api/Auth/envelope-receiver/{key}/request-access-code.
/// </summary>
public async Task<bool> RequestEnvelopeReceiverAccessCodeAsync(string envelopeKey, CancellationToken cancel = default)
public async Task<SendAccessCodeResult?> RequestEnvelopeReceiverAccessCodeAsync(string envelopeKey, bool autoGenerated = true, CancellationToken cancel = default)
{
using var http = CreateDefaultClient();
var response = await http.PostAsync(
$"/api/Auth/envelope-receiver/{Uri.EscapeDataString(envelopeKey)}/request-access-code",
$"/api/Auth/envelope-receiver/{Uri.EscapeDataString(envelopeKey)}/request-access-code?autoGenerated={autoGenerated}",
null,
cancel);
return response.IsSuccessStatusCode;
return response.StatusCode switch
{
HttpStatusCode.OK => SendAccessCodeResult.Sent,
HttpStatusCode.NoContent => SendAccessCodeResult.NoAccessCodeRequired,
HttpStatusCode.Conflict => SendAccessCodeResult.AlreadySigned,
HttpStatusCode.TooManyRequests => SendAccessCodeResult.RequestLimitExceeded,
_ => null
};
}
/// <summary>

View File

@@ -46,13 +46,12 @@ public sealed class CreateEnvelopeBootstrapStorageService(IJSRuntime jsRuntime)
public sealed record CreateEnvelopeBootstrapPayload(
string Title,
string Message,
int? EnvelopeTypeId,
EnvelopeType? Type,
string Language,
bool UseAccessCode,
bool TFAEnabled,
CertificationType CertificationType,
int FinalEmailToCreator,
int FinalEmailToReceivers,
FinalEmailType FinalEmailToCreator,
FinalEmailType FinalEmailToReceivers,
bool SendReminderEmails,
int FirstReminderDays,
int ReminderIntervalDays,

View File

@@ -8,7 +8,7 @@ public class EnvelopeTypeService(IHttpClientFactory clientFactory)
{
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
public async Task<IReadOnlyList<EnvelopeTypeDto>> GetAsync(CancellationToken cancel = default)
public async Task<IReadOnlyList<EnvelopeTypeDefaultsDto>> GetAsync(CancellationToken cancel = default)
{
var http = clientFactory.CreateClient("EnvelopeGenerator.Server");
var response = await http.GetAsync("/api/EnvelopeType", cancel);
@@ -16,7 +16,7 @@ public class EnvelopeTypeService(IHttpClientFactory clientFactory)
if (!response.IsSuccessStatusCode)
return [];
var data = await response.Content.ReadFromJsonAsync<List<EnvelopeTypeDto>>(JsonOptions, cancel);
var data = await response.Content.ReadFromJsonAsync<List<EnvelopeTypeDefaultsDto>>(JsonOptions, cancel);
return data ?? [];
}
}

View File

@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
namespace EnvelopeGenerator.Server.Controllers;
@@ -92,58 +93,23 @@ public partial class AuthController(
/// The operation is idempotent: if the code was already requested, it returns 200 without re-sending.
/// </summary>
/// <param name="key">Envelope receiver key.</param>
/// <param name="autoGenerated">If the access code was auto-generated while page is loading.</param>
/// <param name="sender">MediatR instance.</param>
/// <param name="cancel">Cancellation token.</param>
/// <response code="200">Access code is already available or requested successfully.</response>
/// <response code="404">Envelope receiver key was not found.</response>
/// <response code="500">Access code could not be persisted or e-mail could not be sent.</response>
[AllowAnonymous]
[HttpPost("envelope-receiver/{key}/request-access-code")]
public async Task<IActionResult> RequestEnvelopeReceiverAccessCode(
[FromRoute] string key,
[FromServices] IMediator mediator,
[FromServices] IEnvelopeHistoryService historyService,
[FromServices] IEnvelopeMailService mailService,
[FromServices] ILogger<AuthController> logger,
CancellationToken cancel)
{
var envelopeReceiver = (await mediator.Send(new ReadEnvelopeReceiverQuery { Key = key }, cancel)).SingleOrDefault();
if (envelopeReceiver is null || envelopeReceiver.Envelope is null || envelopeReceiver.Receiver is null)
return NotFound();
if (envelopeReceiver.Envelope.UseAccessCode != true)
return Ok();
var userReference = envelopeReceiver.Receiver.EmailAddress;
if (await historyService.IsSigned(envelopeReceiver.EnvelopeId, userReference))
return Ok();
var accessCodeAlreadyRequested = await historyService.AccessCodeAlreadyRequested(envelopeReceiver.EnvelopeId, userReference);
if (accessCodeAlreadyRequested)
return Ok();
var historyResult = await historyService.RecordAsync(envelopeReceiver.EnvelopeId, userReference, EnvelopeStatus.AccessCodeRequested);
if (historyResult.IsFailed)
public async Task<IActionResult> RequestEnvelopeReceiverAccessCode([FromServices] ISender sender, [FromRoute] string key, [FromQuery] bool autoGenerated = true, CancellationToken cancel = default)
=> await sender.Send(new SendAccessCodeCommand(key).AllowMultipleRequests(!autoGenerated), cancel) switch
{
logger.LogWarning(
"Failed to record AccessCodeRequested history for envelope {EnvelopeId} and receiver {ReceiverEmail}.",
envelopeReceiver.EnvelopeId,
userReference);
return StatusCode(StatusCodes.Status500InternalServerError);
}
var mailResult = await mailService.SendAccessCodeAsync(envelopeReceiver);
if (mailResult.IsFailed)
{
logger.LogWarning(
"Failed to send access code mail for envelope {EnvelopeId} and receiver {ReceiverEmail}.",
envelopeReceiver.EnvelopeId,
userReference);
return StatusCode(StatusCodes.Status500InternalServerError);
}
return Ok();
}
SendAccessCodeResult.Sent => Ok(),
SendAccessCodeResult.AlreadySigned => Conflict(),
SendAccessCodeResult.NoAccessCodeRequired => NoContent(),
SendAccessCodeResult.RequestLimitExceeded => StatusCode(StatusCodes.Status429TooManyRequests),
_ => Problem(detail: "Unexpected result from SendAccessCodeCommand.", statusCode: StatusCodes.Status500InternalServerError)
};
/// <summary>
/// Removes the per-envelope receiver cookie for the given envelope key.

View File

@@ -20,7 +20,9 @@ public class CustomImagesController(IOptions<CustomImagesOptions> options) : Con
{
/// <summary>
/// Returns the signFLOW app logo and company logo configuration.
/// Anonymous access allowed so the login page can display branding before the user authenticates.
/// </summary>
[HttpGet]
[AllowAnonymous]
public ActionResult<CustomImagesOptions> Get() => Ok(options.Value);
}

View File

@@ -10,9 +10,9 @@
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>EnvelopeGenerator.Server</Product>
<Version>1.8.0-beta</Version>
<FileVersion>1.8.0.0</FileVersion>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<Version>1.9.0-beta</Version>
<FileVersion>1.9.0.0</FileVersion>
<AssemblyVersion>1.9.0.0</AssemblyVersion>
<Copyright>Copyright © 2026 Digital Data GmbH. All rights reserved.</Copyright>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

View File

@@ -289,5 +289,8 @@
"ESignParams": {
"ApplicationName": "signFLOW",
"DefaultReason": " Bestätigt"
},
"SendAccessCodeParams": {
"RepeatRequestBlockingPeriod": "00:01:00"
}
}

View File

@@ -312,6 +312,35 @@ article {
padding: 0 16px;
}
.sender-login-page {
min-height: calc(100vh - 36px);
background: linear-gradient(160deg, #1e2e3e 0%, #2c3e50 40%, #3498db 100%);
padding: 24px 16px;
}
.sender-login-content {
width: 100%;
max-width: 520px;
}
.sender-login-card {
margin: 0 auto;
border-radius: 12px !important;
overflow: hidden;
}
.sender-login-back-link {
color: #1f4f93;
font-size: 0.875rem;
font-weight: 600;
text-decoration: none;
}
.sender-login-back-link:hover {
color: #2f77d2;
text-decoration: underline;
}
.home-card {
border-radius: 12px !important;
overflow: hidden;
@@ -695,6 +724,10 @@ article {
background: linear-gradient(160deg, #1a0533 0%, #3b0764 45%, #6b21a8 100%);
}
[data-sf-theme="purple"] .sender-login-page {
background: linear-gradient(160deg, #1a0533 0%, #3b0764 45%, #6b21a8 100%);
}
[data-sf-theme="purple"] .home-btn-primary {
background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
}
@@ -710,6 +743,14 @@ article {
background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%) !important;
}
/* signFLOW logo inside the sender login card header: centered, larger than nav */
.sender-login-card .card-header .signflow-app-logo {
margin: 0 auto;
height: 5rem !important; /* override inline appsettings height for this context */
width: auto;
opacity: 0.92;
}
[data-sf-theme="purple"] .login-card .card-header {
background: linear-gradient(135deg, #1a0533 0%, #6b21a8 100%) !important;
}
@@ -718,6 +759,10 @@ article {
background: linear-gradient(160deg, #0a0f1e 0%, #111827 50%, #1e1b4b 100%);
}
[data-sf-theme="blazing-dark"] .sender-login-page {
background: linear-gradient(160deg, #0a0f1e 0%, #111827 50%, #1e1b4b 100%);
}
[data-sf-theme="blazing-dark"] .home-btn-primary {
background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
}

View File

@@ -215,9 +215,7 @@ public static class Extensions
Message = faker.Lorem.Paragraph(faker.Random.Number(2, 5)),
TfaEnabled = tfaEnabled,
AddedWhen = DateTime.Now,
CertificationType = CertificationType.AdvancedElectronicSignature,
UseAccessCode = false,
ContractType = (int)ContractType.Contract,
Language = "de",
SendReminderEmails = false,
Comment = faker.Lorem.Sentence(10),

View File

@@ -325,9 +325,11 @@ public class ReplacePlaceholderExtensionsTests
NameSender = "Erika",
IsReadAndConfirm = true,
AdvancedSignature = false,
LinkToDocument = "https://x.io/a",
Message = "Bitte",
NamePortal = "Portal"
NamePortal = "Portal",
EnvelopeUuid = "8dfb71ff-ffc8-455c-910b-205b8caf73d9",
Origin = new Uri("https://x.io"),
ReceiverSignature = "065E8916CACFE21656E90B04565FECAE215EC54D5FEB741CDE84521D97A30E5E",
};
const string template =

View File

@@ -1,11 +1,12 @@
using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Common.Interfaces.Services;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Web.Controllers.Test;
[Obsolete("Use MediatR")]
public class TestEnvelopeTypeController : TestControllerBase<IEnvelopeTypeService, EnvelopeTypeDto, EnvelopeType, int>
public class TestEnvelopeTypeController : TestControllerBase<IEnvelopeTypeService, EnvelopeTypeDefaultsDto, EnvelopeTypeDefaults, EnvelopeType>
{
public TestEnvelopeTypeController(ILogger<TestEnvelopeTypeController> logger, IEnvelopeTypeService service) : base(logger, service)
{