Skip to content

Comments

Ban .edu email domains in pricing form validation#1445

Merged
Alek99 merged 4 commits intomainfrom
devin/1750651392-ban-edu-emails
Jun 23, 2025
Merged

Ban .edu email domains in pricing form validation#1445
Alek99 merged 4 commits intomainfrom
devin/1750651392-ban-edu-emails

Conversation

@devin-ai-integration
Copy link
Contributor

Ban .edu email domains in pricing form validation

Summary

This PR implements generalized validation logic to ban .edu email domains in the pricing form, preventing educational institution emails from being submitted in demo requests.

Changes Made

  • Modified pcweb/pages/pricing/header.py to add .edu domain validation using domain.endswith('.edu')
  • Uses pattern matching instead of hardcoding specific university domains
  • Maintains existing banned domain validation for consumer email providers
  • Preserves all existing form validation behavior

Implementation Details

The validation logic now checks:

if domain in banned_domains or domain.endswith('.edu'):
    self.banned_email = True

This approach is:

  • Generalized: Catches all .edu domains without hardcoding specific universities
  • Maintainable: No need to update a list of university domains
  • Consistent: Uses the same error handling as existing banned domains

Testing

Tested locally with reflex run

  • .edu emails are properly rejected with "Personal emails not allowed!" error message
  • Non-.edu business emails continue to work normally
  • Form validation UI displays correctly with red border and error text

Test Screenshots

Form rejecting .edu email

Link to Devin run

https://app.devin.ai/sessions/e21a6af3d9354f7d9ac4294e054bb675

Requested by: Alek (alek@reflex.dev)

- Add generalized .edu domain validation using endswith('.edu') check
- Prevents educational institution emails from being submitted in demo request form
- Maintains existing banned domain validation for consumer email providers
- Uses pattern matching instead of hardcoding specific university domains

Co-Authored-By: Alek <alek@pynecone.io>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added validation in pcweb/pages/pricing/header.py to prevent educational institution emails from submitting demo requests by blocking .edu domains.

  • Implemented pattern matching using domain.endswith('.edu') check alongside existing banned domain validation
  • Maintains consistent error handling showing 'Personal emails not allowed!' message
  • Uses existing UI feedback with red border for invalid submissions
  • Preserves all current form validation behavior for non-.edu domains

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

if "@" in email:
domain = email.split("@")[1]
if domain in banned_domains:
if domain in banned_domains or domain.endswith('.edu'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a dedicated error message for .edu emails (e.g., 'Educational institution emails are not allowed') instead of reusing 'Personal emails not allowed!'

devin-ai-integration bot and others added 3 commits June 23, 2025 04:13
- Run ruff format to fix code formatting
- Fix import sorting in header.py
- Address pre-commit hook formatting requirements

Co-Authored-By: Alek <alek@pynecone.io>
- Apply ruff formatting to all modified files
- Address remaining pre-commit formatting requirements
- Ensure consistent code style across codebase

Co-Authored-By: Alek <alek@pynecone.io>
- Change from domain.endswith('.edu') to '.edu' in domain
- Now catches domains like 'uncp.edu.pe' where .edu appears in middle
- Tested locally: rejects test@uncp.edu.pe, allows john@company.com
- Addresses user feedback for more comprehensive .edu blocking

Co-Authored-By: Alek <alek@pynecone.io>
@Alek99 Alek99 merged commit 8d4841d into main Jun 23, 2025
9 checks passed
@Alek99 Alek99 deleted the devin/1750651392-ban-edu-emails branch June 23, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants