[PR #1225] [MERGED] feat: automatically set public profile url for OIDC users #1490

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

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1225
Author: @Rainson12
Created: 7/11/2024
Status: Merged
Merged: 8/20/2024
Merged by: @Mythie

Base: mainHead: feat/automatically-set-public-url-for-oidc-users


📝 Commits (2)

  • 8493372 feat: automatically set public profile page url for oidc users
  • f28b313 fix: improve automatic url building

📊 Changes

2 files changed (+22 additions, -0 deletions)

View changed files

📝 apps/web/src/pages/api/auth/[...nextauth].ts (+19 -0)
packages/lib/utils/slugify.ts (+3 -0)

📄 Description

Description

I found the public profile dialog request to be confusing for internal (OIDC) users hence this PR will set the url parameter automatically using the users name. It will remove spaces in the username and will try to find the next available one if the users name is already taken for a public profile.

This change is based on https://github.com/documenso/documenso/pull/1208 as it contains changes that otherwise would conflict this PR

Changes Made

Updated the linkAccount functionality to automatically set the user.url property using user.name

Testing Performed

Tested manually:

  • Create new user using OIDC Login
  • Created new user using OIDC Login but user.url already taken

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Additional Notes

  • It should be considered whether the iteration logic for the next free url should be moved to another class/service.
  • It should be considered whether an environment variable should be used as a feature flag for this
  • It should be considered whether regex should be used instead of .replace()
  • Unfortunately the next auth doesnt allow accessing any prism user property like .url hence I had to use the workaround of 'url' in user && !user.url please let me know if there is any better alternative.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced environment variables to control user sign-up and email verification settings.
    • Enhanced account linking with additional parameters for improved user profile management.
    • Automatically generates unique public profile URLs for users upon authentication via the OpenID Connect (OIDC) provider.
  • Configuration

    • Updated configuration files to include new environment variables NEXT_PRIVATE_OIDC_ALLOW_SIGNUP and NEXT_PRIVATE_OIDC_TRUST_EMAILADDRESSES.

🔄 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/1225 **Author:** [@Rainson12](https://github.com/Rainson12) **Created:** 7/11/2024 **Status:** ✅ Merged **Merged:** 8/20/2024 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/automatically-set-public-url-for-oidc-users` --- ### 📝 Commits (2) - [`8493372`](https://github.com/documenso/documenso/commit/849337218302a9934165f3efd7d67de3d3cc2b82) feat: automatically set public profile page url for oidc users - [`f28b313`](https://github.com/documenso/documenso/commit/f28b3139307a60f5b8dad3271fe4bff7b9cdd880) fix: improve automatic url building ### 📊 Changes **2 files changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `apps/web/src/pages/api/auth/[...nextauth].ts` (+19 -0) ➕ `packages/lib/utils/slugify.ts` (+3 -0) </details> ### 📄 Description ## Description I found the public profile dialog request to be confusing for internal (OIDC) users hence this PR will set the url parameter automatically using the users name. It will remove spaces in the username and will try to find the next available one if the users name is already taken for a public profile. This change is based on https://github.com/documenso/documenso/pull/1208 as it contains changes that otherwise would conflict this PR ## Related Issue - ## Changes Made Updated the linkAccount functionality to automatically set the user.url property using user.name ## Testing Performed Tested manually: * Create new user using OIDC Login * Created new user using OIDC Login but user.url already taken ## Checklist - [X] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [X] I have followed the project's coding style guidelines. - [X] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes * It should be considered whether the iteration logic for the next free url should be moved to another class/service. * It should be considered whether an environment variable should be used as a feature flag for this * It should be considered whether regex should be used instead of `.replace()` * Unfortunately the next auth doesnt allow accessing any prism user property like `.url` hence I had to use the workaround of `'url' in user && !user.url` please let me know if there is any better alternative. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced environment variables to control user sign-up and email verification settings. - Enhanced account linking with additional parameters for improved user profile management. - Automatically generates unique public profile URLs for users upon authentication via the OpenID Connect (OIDC) provider. - **Configuration** - Updated configuration files to include new environment variables `NEXT_PRIVATE_OIDC_ALLOW_SIGNUP` and `NEXT_PRIVATE_OIDC_TRUST_EMAILADDRESSES`. <!-- 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:33:29 +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#1490
No description provided.