Skip to content

Add comprehensive email validation for blocked users#8

Open
ShashankFC wants to merge 1 commit into
blocked-email-validation-prefrom
blocked-email-validation-post
Open

Add comprehensive email validation for blocked users#8
ShashankFC wants to merge 1 commit into
blocked-email-validation-prefrom
blocked-email-validation-post

Conversation

@ShashankFC

@ShashankFC ShashankFC commented Jan 22, 2026

Copy link
Copy Markdown

Test 3

Summary by CodeRabbit

Release Notes

New Features

  • Added email blocking mechanism for account creation that prevents specific email addresses from being used
  • Enhanced email validation to track and reject previously failed emails
  • Improved account creation error responses with detailed validation information

Database

  • New database table added to persist blocked email configurations and tracking data

✏️ Tip: You can customize this high-level summary in your review settings.


Replicated from ai-code-review-evaluation/discourse-coderabbit#3


Note

Medium Risk
Touches account creation and email validation paths and adds a new database-backed blocking mechanism; misconfiguration or validator bugs could prevent legitimate signups.

Overview
Adds a persistent blocked email system: introduces BlockedEmail + migration and an EmailValidator that enforces domain allow/deny lists and blocks specific emails while tracking match statistics.

Updates User to use the new email: true validator and extends UsersController#create failure responses to include structured errors and submitted values. The signup modal (CreateAccountController) now remembers rejected emails from the server and marks them invalid on subsequent attempts without re-submitting.

Written by Cursor Bugbot for commit 5f8a130. Configure here.

… many times each email address is blocked, and last time it was blocked. Move email validation out of User model and into EmailValidator. Signup form remembers which email addresses have failed and shows validation error on email field.
@ShashankFC

Copy link
Copy Markdown
Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

record.save
end
record && record.action_type == actions[:block]
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Validation side-effect causes double match_count increment

Medium Severity

BlockedEmail.should_block? has a database write side-effect (incrementing match_count and calling save) but is invoked from within a validator. In users_controller.rb#create, user.valid? on line 168 triggers validations (including EmailValidatorshould_block?), and then user.save on line 172 re-runs all validations, calling should_block? a second time. This causes match_count to be incremented by 2 for every single account creation attempt with a blocked email, producing inaccurate tracking data.

Additional Locations (1)

Fix in Cursor Fix in Web

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