[PR #2349] feat: add validation for API token expiration date #2236

Open
opened 2026-02-26 20:33:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2349
Author: @giteshsarvaiya
Created: 12/30/2025
Status: 🔄 Open

Base: mainHead: feat/add-token-expiration-validation-in-api-token-flow


📝 Commits (1)

  • 103a1bc feat: add validation for API token expiration date

📊 Changes

2 files changed (+50 additions, -17 deletions)

View changed files

📝 apps/remix/app/components/forms/token.tsx (+44 -16)
📝 packages/trpc/server/api-token-router/create-api-token.types.ts (+6 -1)

📄 Description

Description

Context:- "Create API Token" component in the "/settings/tokens" route.

Tasks performed:-

  • Add frontend validation with form refinement
  • Add backend API validation with Zod schema
  • Show error message when neither expiration date nor 'never expire' is selected

In the "/settings/tokens" route, the create token form's behavior:-

There are some edge cases present in the currrent app:-

  1. The token name is validated but the token expiry date is not.
  2. when we create a token without selecting token expiry date or without enabling "never expire" toggle, it creates a new token with no expiry.
  3. When we create a token, the entire form state is not nulled, rather only the name is nulled.

Now the UX has been improved

New Behaviour:-

  1. Both, token name and the expiration date are validated.
  2. User sees an error below the field if token expiry date is not selected or the "never expire" switch is not enabled
  3. The entire form state is nulled (reset) after successfully creating a token.
  4. The API endpoint is also secured by zod validation.

Attaching a video with explanation:-
Loom Link

Checklist

  • I have tested these changes locally and they work as expected.
  • I have been successful in building the project locally 'npm run build'
  • I have followed the project's coding style guidelines.

🔄 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/2349 **Author:** [@giteshsarvaiya](https://github.com/giteshsarvaiya) **Created:** 12/30/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/add-token-expiration-validation-in-api-token-flow` --- ### 📝 Commits (1) - [`103a1bc`](https://github.com/documenso/documenso/commit/103a1bc2b5457db78864763f21f0f9811eb8fe4c) feat: add validation for API token expiration date ### 📊 Changes **2 files changed** (+50 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `apps/remix/app/components/forms/token.tsx` (+44 -16) 📝 `packages/trpc/server/api-token-router/create-api-token.types.ts` (+6 -1) </details> ### 📄 Description ## Description ### Context:- "Create API Token" component in the "/settings/tokens" route. Tasks performed:- - Add frontend validation with form refinement - Add backend API validation with Zod schema - Show error message when neither expiration date nor 'never expire' is selected #### In the "/settings/tokens" route, the create token form's behavior:- There are some edge cases present in the currrent app:- 1) The token name is validated but the token expiry date is not. 2) when we create a token without selecting token expiry date or without enabling "never expire" toggle, it creates a new token with no expiry. 3) When we create a token, the entire form state is not nulled, rather only the name is nulled. #### Now the UX has been improved New Behaviour:- 1) Both, token name and the expiration date are validated. 2) User sees an error below the field if token expiry date is not selected or the "never expire" switch is not enabled 3) The entire form state is nulled (reset) after successfully creating a token. 4) The API endpoint is also secured by zod validation. Attaching a video with explanation:- [Loom Link](https://www.loom.com/share/29c2c092f22a4eab9bb87bf114ac12b5) ## Checklist - [x] I have tested these changes locally and they work as expected. - [x] I have been successful in building the project locally 'npm run build' - [x] I have followed the project's coding style guidelines. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2236
No description provided.