Add comprehensive email validation for blocked users#8
Add comprehensive email validation for blocked users#8akshayutture-augment wants to merge 1 commit into
Conversation
… 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.
|
@claude review this PR |
1 similar comment
|
@claude review this PR |
|
Claude finished @akshayutture-augment's task —— View job Code Review Complete ✅I've reviewed the PR that adds comprehensive email validation for blocked users. Here's my detailed feedback: OverviewThis PR extracts email validation logic from the User model into a separate EmailValidator class and introduces a BlockedEmail model to track and block email addresses. The implementation also includes client-side feedback for rejected emails. 🔴 Critical Issues1. Race Condition and Side Effect in Validation (app/models/blocked_email.rb:11-18)The def self.should_block?(email)
record = BlockedEmail.where(email: email).first
if record
record.match_count += 1
record.last_match_at = Time.zone.now
record.save
end
record && record.action_type == actions[:block]
endProblems:
Recommendation: Separate the "check" logic from the "record statistics" logic. The statistics update should happen after successful validation failure, not during the check itself. 2. Missing Newline at End of File (lib/validators/email_validator.rb:24)The file is missing a newline at the end, which violates POSIX standards and can cause issues with some tools. 3. Logic Error in Validation Check (lib/validators/email_validator.rb:13)if record.errors[attribute].blank? and BlockedEmail.should_block?(value)Using
|
|
This pull request has been automatically marked as stale because it has been open for 60 days with no activity. To keep it open, remove the stale tag, push code, or add a comment. Otherwise, it will be closed in 14 days. |
Test 3
Replicated from ai-code-review-evaluation/discourse-greptile#3