[PR #21891] feat: implement open email registration with conditional organization assignment #29777

Closed
opened 2026-02-21 20:46:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/21891

State: closed
Merged: No


Summary

Implements comprehensive open email registration feature that removes domain restrictions while maintaining backward compatibility.

Key Changes

🔧 Backend API Changes

  • Remove email domain validation from registration endpoint
  • Conditional organization assignment: Auto-assign if domain matches, otherwise allow NULL
  • Database schema support for users without organization assignment
  • Backward compatibility maintained for existing organization users

🎨 Frontend Changes

  • Remove .edu domain restrictions from chat-miniprogram login component
  • Update UI text to be more generic ("请输入邮箱地址" instead of "请输入学校邮箱")
  • Maintain user experience for both organization and individual users

🧪 Testing & Quality

  • Manual API test script for validation (tests/manual/test_registration_api.py)
  • Comprehensive error handling testing
  • Code formatting applied across 23 files with ruff format
  • All linting checks pass with uv run ruff check

🚀 DevOps Improvements

  • Fixed deploy-backend workflow to separate build and deploy phases
  • PR builds images, merge deploys using pre-built images
  • Improved workflow clarity with better step descriptions

Registration Flow Changes

Before

Email domain check → Must match organization → Registration allowed

After

Email domain check → If matches: assign to org  < /dev/null |  If not: allow without org

Testing Results

Verification codes sent successfully to ALL email types:

  • University emails (.edu)
  • Personal emails (gmail.com, outlook.com, protonmail.com)
  • Company emails (company.com, startup.io)

Proper error handling for invalid emails and codes
Rate limiting works correctly
Backward compatibility preserved for existing users

Implementation Details

Modified Files

  • api/controllers/service_api_with_auth/auth/login.py - Remove domain validation
  • api/tests/manual/test_registration_api.py - Manual testing script
  • .github/workflows/deploy-backend.yml - Improved CI/CD workflow
  • Multiple files formatted with ruff format for code quality

Database Schema

  • Uses existing nullable organization_id columns (no breaking changes)
  • Migration applied for performance indexes
  • Supports users with and without organization assignment

Test Plan

  • Test verification code sending for various email domains
  • Validate error handling for invalid inputs
  • Confirm backward compatibility with existing organization users
  • Verify rate limiting functionality
  • Test chat-miniprogram frontend changes
  • Run linting and formatting checks (uv run ruff check - all passed)
  • Manual API testing with live server validation

Deployment Notes

  • Backend changes are backward compatible
  • Frontend changes require chat-miniprogram rebuild
  • No service disruption expected
  • Docker images will be built automatically on PR merge

Code Quality

  • All linting checks pass (uv run ruff check)
  • Code formatting applied consistently (ruff format)
  • TypeScript compilation successful
  • No breaking changes to existing functionality

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/langgenius/dify/pull/21891 **State:** closed **Merged:** No --- ## Summary Implements comprehensive open email registration feature that removes domain restrictions while maintaining backward compatibility. ### Key Changes #### 🔧 Backend API Changes - **Remove email domain validation** from registration endpoint - **Conditional organization assignment**: Auto-assign if domain matches, otherwise allow NULL - **Database schema support** for users without organization assignment - **Backward compatibility** maintained for existing organization users #### 🎨 Frontend Changes - **Remove .edu domain restrictions** from chat-miniprogram login component - **Update UI text** to be more generic ("请输入邮箱地址" instead of "请输入学校邮箱") - **Maintain user experience** for both organization and individual users #### 🧪 Testing & Quality - **Manual API test script** for validation (`tests/manual/test_registration_api.py`) - **Comprehensive error handling** testing - **Code formatting** applied across 23 files with `ruff format` - **All linting checks pass** with `uv run ruff check` #### 🚀 DevOps Improvements - **Fixed deploy-backend workflow** to separate build and deploy phases - **PR builds images**, **merge deploys** using pre-built images - **Improved workflow clarity** with better step descriptions ### Registration Flow Changes #### Before ``` Email domain check → Must match organization → Registration allowed ``` #### After ``` Email domain check → If matches: assign to org < /dev/null | If not: allow without org ``` ### Testing Results ✅ **Verification codes sent successfully** to ALL email types: - University emails (.edu) - Personal emails (gmail.com, outlook.com, protonmail.com) - Company emails (company.com, startup.io) ✅ **Proper error handling** for invalid emails and codes ✅ **Rate limiting** works correctly ✅ **Backward compatibility** preserved for existing users ## Implementation Details ### Modified Files - `api/controllers/service_api_with_auth/auth/login.py` - Remove domain validation - `api/tests/manual/test_registration_api.py` - Manual testing script - `.github/workflows/deploy-backend.yml` - Improved CI/CD workflow - Multiple files formatted with `ruff format` for code quality ### Database Schema - Uses existing nullable `organization_id` columns (no breaking changes) - Migration applied for performance indexes - Supports users with and without organization assignment ## Test Plan - [x] Test verification code sending for various email domains - [x] Validate error handling for invalid inputs - [x] Confirm backward compatibility with existing organization users - [x] Verify rate limiting functionality - [x] Test chat-miniprogram frontend changes - [x] Run linting and formatting checks (`uv run ruff check` - all passed) - [x] Manual API testing with live server validation ## Deployment Notes - Backend changes are backward compatible - Frontend changes require chat-miniprogram rebuild - No service disruption expected - Docker images will be built automatically on PR merge ## Code Quality - ✅ All linting checks pass (`uv run ruff check`) - ✅ Code formatting applied consistently (`ruff format`) - ✅ TypeScript compilation successful - ✅ No breaking changes to existing functionality 🤖 Generated with [Claude Code](https://claude.ai/code)
yindo added the pull-request label 2026-02-21 20:46:13 -05:00
yindo closed this issue 2026-02-21 20:46:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29777