-
Notifications
You must be signed in to change notification settings - Fork 93
email verification in gin-mongo pipeline #181
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: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds email verification functionality to the Gin-MongoDB pipeline using the AfterShip/email-verifier library. The implementation introduces a new GET endpoint /verify-email that validates email syntax and reachability before allowing data to be stored in MongoDB, improving data quality and preventing invalid email addresses from entering the system.
Key changes:
- Added email verification endpoint with comprehensive validation logic
- Updated Go version from 1.17 to 1.22 with appropriate toolchain configuration
- Fixed logger initialization to use package-level variable
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| gin-mongo/main.go | Fixed logger initialization and registered new email verification endpoint |
| gin-mongo/handler.go | Implemented verifyEmail handler with syntax and reachability checks |
| gin-mongo/go.mod | Upgraded Go version to 1.22 and added email-verifier dependency |
| gin-mongo/keploy/.gitignore | Added reports directory to gitignore |
| gin-mongo/keploy.yml | Added Keploy configuration file for testing |
Comments suppressed due to low confidence (1)
gin-mongo/go.mod:1
- Corrected spelling of 'configration' to 'configuration'.
module test-app-url-shortener
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| response.Valid = false | ||
| response.Reachable = false | ||
| response.Message = "Email syntax is invalid" | ||
| } else if result.Reachable == "no" { |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string comparison result.Reachable == \"no\" is fragile and prone to errors. Consider using constants or an enum-like type for the Reachable field values to make the code more maintainable and less error-prone. For example, define constants like ReachableNo, ReachableYes, ReachableUnknown based on the email-verifier library's documentation.
Signed-off-by: Shashank Shekhar <[email protected]>
Signed-off-by: Shashank Shekhar <[email protected]>
Signed-off-by: Shashank Shekhar <[email protected]>
| dbName, collection := "keploy", "url-shortener" | ||
|
|
||
| client, err := New("mongoDb:27017", dbName) | ||
| client, err := New("localhost:27017", dbName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change it back to mongodb
| func main() { | ||
| time.Sleep(2 * time.Second) | ||
| logger, _ := zap.NewProduction() | ||
| logger, _ = zap.NewProduction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this change made?
What does this PR do?
Solves: #3183
This PR adds email verification functionality to the Gin–MongoDB pipeline.
It introduces a verification endpoint that validates user emails using the AfterShip/email-verifier library before allowing them into the system. This ensures data accuracy and prevents invalid or unreachable email addresses from being stored in the MongoDB collection.