Skip to content

Conversation

@Stunxzz
Copy link
Collaborator

@Stunxzz Stunxzz commented Sep 7, 2025

🧾 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:

  • A custom AppUser model inheriting from AbstractUser.
  • A DRF serializer AppUserSerializer with password confirmation and backend validation.
  • A view to handle registration requests.
  • A CustomPasswordValidator enforcing password complexity (minimum length, uppercase, lowercase, digits).

💡 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

  • Tested locally
  • Unit tests added or updated
  • Integration tests performed
  • Verified on staging environment

✅ Checklist

  • I have performed a self-review of my code.
  • I have commented my code, especially in hard-to-understand areas.
  • I have updated documentation (if applicable).
  • The feature has sufficient test coverage.
  • No new warnings or errors introduced.

🔗 Related Issue(s) (if applicable)

  • Related to #

📝 Additional Notes (Optional)

@Stunxzz Stunxzz requested a review from karastoyanov September 7, 2025 16:58
@Stunxzz Stunxzz linked an issue Sep 7, 2025 that may be closed by this pull request
@karastoyanov karastoyanov requested a review from Copilot September 7, 2025 16:59
Copy link
Contributor

Copilot AI left a 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.

karastoyanov and others added 5 commits September 7, 2025 20:01
…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>
@karastoyanov karastoyanov merged commit 78657ce into master Sep 7, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Django register backend rework

3 participants