[PR #1478] [MERGED] feat: support windows for 2fa tokens #1657

Closed
opened 2026-02-26 19:34:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1478
Author: @Mythie
Created: 11/15/2024
Status: Merged
Merged: 11/15/2024
Merged by: @Mythie

Base: mainHead: feat/2fa-token-window


📝 Commits (1)

  • e665409 feat: support windows for 2fa tokens

📊 Changes

2 files changed (+24 additions, -5 deletions)

View changed files

📝 packages/lib/server-only/2fa/verify-2fa-token.ts (+23 -5)
📝 packages/lib/server-only/document/is-recipient-authorized.ts (+1 -0)

📄 Description

Description

When using 2fa enabled authentication on direct templates we run into an issue where a 2fa token has been attached to a field but it's submitted at a later point.

To better facilitate this we have introduced the ability to have a window of valid tokens.

This won't affect other signing methods since tokens are verified immediately after they're entered.

N/A

Changes Made

  • Updated our validate2FAToken method to use a window based approach rather than the default verify method.

Testing Performed

  • Created a series of tokens and tested upon different intervals and windows to confirm functionality works as expected.

Summary by CodeRabbit

  • New Features

    • Transitioned from TOTP to HOTP for two-factor authentication, allowing for configurable time windows and periods for token validation.
    • Extended the time frame for token validation to 10 minutes in the authorization process.
  • Bug Fixes

    • Improved error handling for token verification processes while maintaining existing authentication checks.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/1478 **Author:** [@Mythie](https://github.com/Mythie) **Created:** 11/15/2024 **Status:** ✅ Merged **Merged:** 11/15/2024 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/2fa-token-window` --- ### 📝 Commits (1) - [`e665409`](https://github.com/documenso/documenso/commit/e66540974d3e42a1312e04baeb4080ad38fa5218) feat: support windows for 2fa tokens ### 📊 Changes **2 files changed** (+24 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/lib/server-only/2fa/verify-2fa-token.ts` (+23 -5) 📝 `packages/lib/server-only/document/is-recipient-authorized.ts` (+1 -0) </details> ### 📄 Description ## Description When using 2fa enabled authentication on direct templates we run into an issue where a 2fa token has been attached to a field but it's submitted at a later point. To better facilitate this we have introduced the ability to have a window of valid tokens. This won't affect other signing methods since tokens are verified immediately after they're entered. ## Related Issue N/A ## Changes Made - Updated our validate2FAToken method to use a window based approach rather than the default verify method. ## Testing Performed - Created a series of tokens and tested upon different intervals and windows to confirm functionality works as expected. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Transitioned from TOTP to HOTP for two-factor authentication, allowing for configurable time windows and periods for token validation. - Extended the time frame for token validation to 10 minutes in the authorization process. - **Bug Fixes** - Improved error handling for token verification processes while maintaining existing authentication checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 19:34:12 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#1657
No description provided.