fix: improve login form validation with sequential checks #312#379
Open
eshwar210607 wants to merge 2 commits into
Open
fix: improve login form validation with sequential checks #312#379eshwar210607 wants to merge 2 commits into
eshwar210607 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR improves the user experience of the login form by implementing sequential validation.
🛠️ Changes:
Refactored Validation Logic: Replaced the previous bitwise AND operator with step-by-step conditional checks.
Early Returns: Added early returns to ensure that only one validation error is displayed at a time.
Validation Order: The form now validates the Email first. Password validation is only triggered once a valid email format is provided.
🌟 Why this is better:
Previously, multiple validation errors could appear simultaneously or in a confusing order. Now, the user receives clear, one-at-a-time feedback, making the login process more intuitive and less overwhelming for the user.
🔗 Related Issues
Fixes #312
📷 Screenshots

Email Validation (Shows first):
Password Validation (Shows only after email is valid):

✅ Checklist
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] Only the necessary files (src/components/AuthPage/Login/index.jsx) are included in this PR.