Implement LoginPage component with authentication functionality #26
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.
This PR implements the complete LoginPage component with authentication functionality for the checkout flow, addressing all requirements specified in the issue.
Overview
The LoginPage component previously existed as a shell without actual login functionality. This implementation adds complete authentication capabilities including form fields, validation, API integration, and proper navigation flow.
Key Features Implemented
1. Field Component Enhancement
Enhanced the existing Field component with a new
manageStateproperty that allows disabling form data storage in the checkout form store. This enables password fields to bypass state management for security reasons while maintaining backward compatibility.2. LoginFields Component
Replaced the stub implementation with a fully functional login form containing:
manageState: falseto prevent storage in form store3. Authentication Service
Created a new authentication service following existing codebase patterns:
${LMS_BASE_URL}/api/user/v1/account/login_session/setAuthenticatedUserfrom @edx/frontend-platform4. Route Protection
Implemented authentication checking that:
getAuthenticatedUser()to check current authentication state/plan-detailsif user is already logged in when accessing/plan-details/login5. Form Submission with React Query
Integrated React Query mutation for login handling:
/plan-detailson successful loginTechnical Implementation
Schema and Type Updates
LoginSchemawith email and password validation using ZodLoginDatatype with full TypeScript integrationRoute Configuration
/plan-details/login(already configured)Form Handling
The implementation supports different form types for different pages within the same component:
PlanDetailsDatafor the main plan details formLoginDatafor the login formTesting
Code Quality
The login functionality is now fully implemented and ready for backend integration. The authentication service is configured to work with the edxapp login endpoint, and all form handling, validation, and navigation flows are properly implemented according to the requirements.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.