-
Notifications
You must be signed in to change notification settings - Fork 0
Add comprehensive email validation for blocked users #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: blocked-email-validation-pre
Are you sure you want to change the base?
Add comprehensive email validation for blocked users #8
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
|
Test 3
Replicated from ai-code-review-evaluation/discourse-greptile#3