-
Notifications
You must be signed in to change notification settings - Fork 0
Add DRF User Registration with Custom Password Validation #7
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
Conversation
- added CORS rules - register viewl & serializers
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 implements a user registration system using Django REST Framework, replacing the existing auth module with a new userauth module. It introduces custom password validation and a custom user model with email-based authentication.
- Replaces the old auth module with a new userauth module
- Implements user registration API with password validation and confirmation
- Adds custom password complexity requirements (minimum length, uppercase, lowercase, digits)
Reviewed Changes
Copilot reviewed 13 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| userauth/models.py | Defines custom AppUser model with email as primary login field |
| userauth/serializers.py | Implements registration serializer with password validation and confirmation |
| userauth/views.py | Creates registration API endpoint using DRF CreateAPIView |
| userauth/validators.py | Adds custom password validator with complexity requirements |
| userauth/tests.py | Provides test coverage for registration endpoint scenarios |
| userauth/urls.py | Defines URL routing for registration endpoint |
| userauth/apps.py | Updates app configuration name |
| skill_forge/settings.py | Configures custom user model, CORS, and password validators |
| skill_forge/urls.py | Updates main URL routing and adds debug toolbar |
| auth/* | Removes old auth module files |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ect/skill_forge_backend into feature/django-register
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
🧾 Summary
Implemented user registration endpoint using Django REST Framework. Added custom password validation and a custom user model inheriting from AbstractUser to enforce password rules and handle user creation securely.
🧩 Issue Description
The current system did not provide an API endpoint for user registration. There was no validation for password strength, and the default User model did not meet the project’s requirements for custom fields.
This PR introduces:
💡 Proposed Solution
Created a new DRF serializer to handle registration input and password validation (AppUserSerializer).
Implemented CustomPasswordValidator to ensure passwords are strong.
Updated AUTH_PASSWORD_VALIDATORS in settings to include the custom validator.
Created a view (RegisterView) to accept POST requests with user data and return appropriate validation errors.
Passwords are hashed using set_password() before saving.
Manual testing was performed to ensure proper validation and user creation.
🧪 Testing Instructions
✅ Checklist
🔗 Related Issue(s) (if applicable)
📝 Additional Notes (Optional)