mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-01 22:07:03 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -97,7 +97,7 @@ class LoginInputSerializer(serializers.Serializer):
|
||||
password=password,
|
||||
)
|
||||
|
||||
if not user:
|
||||
if not user: # noqa: SIM102
|
||||
# Try email-based authentication if username failed
|
||||
if "@" in username:
|
||||
try:
|
||||
@@ -138,7 +138,7 @@ class LoginInputSerializer(serializers.Serializer):
|
||||
"first_name": "John",
|
||||
"last_name": "Doe",
|
||||
},
|
||||
"message": "Login successful",
|
||||
"detail": "Login successful",
|
||||
},
|
||||
)
|
||||
]
|
||||
@@ -213,7 +213,7 @@ class SignupInputSerializer(serializers.ModelSerializer):
|
||||
try:
|
||||
validate_password(value)
|
||||
except DjangoValidationError as e:
|
||||
raise serializers.ValidationError(list(e.messages))
|
||||
raise serializers.ValidationError(list(e.messages)) from None
|
||||
return value
|
||||
|
||||
def validate(self, attrs):
|
||||
@@ -253,7 +253,7 @@ class SignupInputSerializer(serializers.ModelSerializer):
|
||||
"first_name": "Jane",
|
||||
"last_name": "Smith",
|
||||
},
|
||||
"message": "Registration successful",
|
||||
"detail": "Registration successful",
|
||||
},
|
||||
)
|
||||
]
|
||||
@@ -276,7 +276,7 @@ class SignupOutputSerializer(serializers.Serializer):
|
||||
summary="Example logout response",
|
||||
description="Successful logout response",
|
||||
value={
|
||||
"message": "Logout successful",
|
||||
"detail": "Logout successful",
|
||||
},
|
||||
)
|
||||
]
|
||||
@@ -318,9 +318,9 @@ class PasswordResetInputSerializer(serializers.Serializer):
|
||||
"""Send password reset email."""
|
||||
email = self.validated_data["email"] # type: ignore[index]
|
||||
try:
|
||||
_user = UserModel.objects.get(email=email)
|
||||
# Check if email exists (but don't reveal the result for security)
|
||||
UserModel.objects.get(email=email)
|
||||
# Here you would typically send a password reset email
|
||||
# For now, we'll just pass
|
||||
pass
|
||||
except UserModel.DoesNotExist:
|
||||
# Don't reveal if email exists for security
|
||||
@@ -393,7 +393,7 @@ class PasswordChangeInputSerializer(serializers.Serializer):
|
||||
try:
|
||||
validate_password(value, user=self.context["request"].user)
|
||||
except DjangoValidationError as e:
|
||||
raise serializers.ValidationError(list(e.messages))
|
||||
raise serializers.ValidationError(list(e.messages)) from None
|
||||
return value
|
||||
|
||||
def validate(self, attrs):
|
||||
@@ -492,6 +492,4 @@ class AuthStatusOutputSerializer(serializers.Serializer):
|
||||
"""Output serializer for authentication status."""
|
||||
|
||||
authenticated = serializers.BooleanField(help_text="Whether user is authenticated")
|
||||
user = UserOutputSerializer(
|
||||
allow_null=True, help_text="User information if authenticated"
|
||||
)
|
||||
user = UserOutputSerializer(allow_null=True, help_text="User information if authenticated")
|
||||
|
||||
Reference in New Issue
Block a user