[PR #818] [MERGED] feat(oauth2): add email format transformation support #784

Closed
opened 2026-02-26 21:32:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818
Author: @dreamhunter2333
Created: 1/23/2026
Status: Merged
Merged: 1/23/2026
Merged by: @dreamhunter2333

Base: mainHead: feature/email


📝 Commits (3)

  • 5016787 feat(oauth2): add email format transformation support
  • 9bd167f chore: update lock files and version
  • 888f21f fix: restore accessTokenFormat as optional field

📊 Changes

13 files changed (+907 additions, -792 deletions)

View changed files

📝 frontend/package.json (+2 -2)
📝 frontend/pnpm-lock.yaml (+227 -227)
📝 frontend/src/models/index.ts (+3 -0)
📝 frontend/src/views/admin/UserOauth2Settings.vue (+72 -67)
📝 pages/package.json (+1 -1)
📝 vitepress-docs/docs/en/guide/feature/user-oauth2.md (+42 -0)
📝 vitepress-docs/docs/zh/guide/feature/user-oauth2.md (+42 -0)
📝 vitepress-docs/package.json (+2 -2)
📝 vitepress-docs/pnpm-lock.yaml (+292 -292)
📝 worker/package.json (+7 -7)
📝 worker/pnpm-lock.yaml (+193 -193)
📝 worker/src/models/index.ts (+3 -0)
📝 worker/src/user_api/oauth2.ts (+21 -1)

📄 Description

User description

Summary

  • Add OAuth2 email format transformation feature with regex pattern and replacement template
  • Add Linux Do OAuth2 template with pre-configured email format settings
  • Add input length limit (256 chars) to prevent ReDoS attacks
  • Update admin UI with conditional display and tooltips
  • Update documentation (zh/en) with configuration examples

New Features

Field Description
Enable Email Format Toggle to enable email format transformation
Email Regex Pattern Regex to match the original value with capture groups ()
Replace Template Replacement template using $1, $2, etc.

Examples

Scenario Original Value Regex Pattern Replace Template Result
ID to Email 12345 ^(.+)$ linux_do_$1@oauth.linux.do linux_do_12345@oauth.linux.do
Change Domain john@old.com ^(.+)@old\.com$ $1@new.com john@new.com

Test plan

  • Test Linux Do OAuth2 login with email format transformation
  • Test GitHub OAuth2 login (should work as before)
  • Verify admin UI conditional display works correctly
  • Verify tooltip help text displays on hover

🤖 Generated with Claude Code


PR Type

Enhancement, Documentation, Tests


Description

  • Added email format transformation for OAuth2 with regex and templates.

    • Introduced new fields: enableEmailFormat, userEmailFormat, userEmailReplace.
    • Added pre-configured template for Linux Do OAuth2 provider.
  • Updated admin UI to support email transformation settings.

    • Added tooltips and conditional display for new fields.
  • Enhanced backend logic to apply email transformation securely.

    • Limited input length to prevent ReDoS attacks.
  • Updated documentation with examples and configuration details.

    • Added English and Chinese guides for new features.

Diagram Walkthrough

flowchart LR
  frontend["Frontend UI"] -- "New fields for email transformation" --> adminUI["Admin UI"]
  adminUI -- "Conditional display & tooltips" --> backend["Backend Logic"]
  backend -- "Regex-based email transformation" --> oauth2["OAuth2 Providers"]
  oauth2 -- "Linux Do pre-configured template" --> documentation["Documentation Updates"]

File Walkthrough

Relevant files
Enhancement
4 files
UserOauth2Settings.vue
Add UI support for email transformation settings                 
+72/-67 
index.ts
Extend OAuth2 settings model with email transformation fields
+4/-1     
index.ts
Update worker-side model for email transformation               
+3/-0     
oauth2.ts
Implement email transformation logic in OAuth2 flow           
+21/-1   
Dependencies
2 files
package.json
Update frontend dependencies and version                                 
+2/-2     
package.json
Update worker dependencies and version                                     
+7/-7     
Documentation
2 files
user-oauth2.md
Add English documentation for email transformation             
+42/-0   
user-oauth2.md
Add Chinese documentation for email transformation             
+42/-0   


🔄 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/dreamhunter2333/cloudflare_temp_email/pull/818 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 1/23/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/email` --- ### 📝 Commits (3) - [`5016787`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/501678751f240900d266f7e5616ddbf37588899e) feat(oauth2): add email format transformation support - [`9bd167f`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/9bd167fb461e3798ec08be89f71fc5204f3066e9) chore: update lock files and version - [`888f21f`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/888f21f8cc3c5eded7ea2b8e1ffb176856a700e2) fix: restore accessTokenFormat as optional field ### 📊 Changes **13 files changed** (+907 additions, -792 deletions) <details> <summary>View changed files</summary> 📝 `frontend/package.json` (+2 -2) 📝 `frontend/pnpm-lock.yaml` (+227 -227) 📝 `frontend/src/models/index.ts` (+3 -0) 📝 `frontend/src/views/admin/UserOauth2Settings.vue` (+72 -67) 📝 `pages/package.json` (+1 -1) 📝 `vitepress-docs/docs/en/guide/feature/user-oauth2.md` (+42 -0) 📝 `vitepress-docs/docs/zh/guide/feature/user-oauth2.md` (+42 -0) 📝 `vitepress-docs/package.json` (+2 -2) 📝 `vitepress-docs/pnpm-lock.yaml` (+292 -292) 📝 `worker/package.json` (+7 -7) 📝 `worker/pnpm-lock.yaml` (+193 -193) 📝 `worker/src/models/index.ts` (+3 -0) 📝 `worker/src/user_api/oauth2.ts` (+21 -1) </details> ### 📄 Description ### **User description** ## Summary - Add OAuth2 email format transformation feature with regex pattern and replacement template - Add Linux Do OAuth2 template with pre-configured email format settings - Add input length limit (256 chars) to prevent ReDoS attacks - Update admin UI with conditional display and tooltips - Update documentation (zh/en) with configuration examples ## New Features | Field | Description | |-------|-------------| | Enable Email Format | Toggle to enable email format transformation | | Email Regex Pattern | Regex to match the original value with capture groups `()` | | Replace Template | Replacement template using `$1`, `$2`, etc. | ## Examples | Scenario | Original Value | Regex Pattern | Replace Template | Result | |----------|---------------|---------------|------------------|--------| | ID to Email | `12345` | `^(.+)$` | `linux_do_$1@oauth.linux.do` | `linux_do_12345@oauth.linux.do` | | Change Domain | `john@old.com` | `^(.+)@old\.com$` | `$1@new.com` | `john@new.com` | ## Test plan - [ ] Test Linux Do OAuth2 login with email format transformation - [ ] Test GitHub OAuth2 login (should work as before) - [ ] Verify admin UI conditional display works correctly - [ ] Verify tooltip help text displays on hover 🤖 Generated with [Claude Code](https://claude.com/claude-code) ___ ### **PR Type** Enhancement, Documentation, Tests ___ ### **Description** - Added email format transformation for OAuth2 with regex and templates. - Introduced new fields: `enableEmailFormat`, `userEmailFormat`, `userEmailReplace`. - Added pre-configured template for Linux Do OAuth2 provider. - Updated admin UI to support email transformation settings. - Added tooltips and conditional display for new fields. - Enhanced backend logic to apply email transformation securely. - Limited input length to prevent ReDoS attacks. - Updated documentation with examples and configuration details. - Added English and Chinese guides for new features. ___ ### Diagram Walkthrough ```mermaid flowchart LR frontend["Frontend UI"] -- "New fields for email transformation" --> adminUI["Admin UI"] adminUI -- "Conditional display & tooltips" --> backend["Backend Logic"] backend -- "Regex-based email transformation" --> oauth2["OAuth2 Providers"] oauth2 -- "Linux Do pre-configured template" --> documentation["Documentation Updates"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>4 files</summary><table> <tr> <td><strong>UserOauth2Settings.vue</strong><dd><code>Add UI support for email transformation settings</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-5ded2f107f7fd8a04eb55462a9cb55b85bee3afc56fc45f8ba6a4bcf90755ebb">+72/-67</a>&nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Extend OAuth2 settings model with email transformation fields</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-c27b6b2795955789411e9958ddb12e04fa93ef3951047ea65a1542771341a7b1">+4/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Update worker-side model for email transformation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-430bcc4ffa98738e7419c774a53ba2ce8b5127a36b3741e89bf36b95a56f02bc">+3/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>oauth2.ts</strong><dd><code>Implement email transformation logic in OAuth2 flow</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-fede9bc68112c797eefa07c6e6cc20a6aa107addb3e5636757131589a435e13b">+21/-1</a>&nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Dependencies</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>package.json</strong><dd><code>Update frontend dependencies and version</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-da6498268e99511d9ba0df3c13e439d10556a812881c9d03955b2ef7c6c1c655">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>package.json</strong><dd><code>Update worker dependencies and version</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-89dc6f41a53ce13f2da5a00dd34868762e6cd0df46eddc9f5c3c4510b1493870">+7/-7</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>user-oauth2.md</strong><dd><code>Add English documentation for email transformation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-f88f591fc2f7848127185590ce2e0f17b0383f525369ecefebf7f9137d1332f9">+42/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>user-oauth2.md</strong><dd><code>Add Chinese documentation for email transformation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/818/files#diff-c79a7d84a17577c78d15b8bf5168badd3edf51844e43d1be9b5f82514f46693f">+42/-0</a>&nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 21:32:56 +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/cloudflare_temp_email#784
No description provided.