v0.0.31 | 비밀번호 변경 기능 추가
All checks were successful
Build And Test / build-and-push (push) Successful in 3m38s

- ChangePasswordView API 추가 (사용자 본인 비밀번호 변경)
- 소셜 로그인 계정 비밀번호 설정 지원
- 관리자 비밀번호 초기화 기능 (UserUpdateView)
- RegisterSerializer에 has_password 필드 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 00:26:53 +09:00
parent d6bec2c883
commit 1c7f241b37
4 changed files with 86 additions and 4 deletions

View File

@ -5,13 +5,18 @@ from rest_framework.exceptions import ValidationError
class RegisterSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True, required=False)
has_password = serializers.SerializerMethodField()
class Meta:
model = CustomUser
fields = ("email", "name", "password", "grade", "desc",
"phone", "address", "gender", "birth_date", "education",
"social_provider", "profile_image")
read_only_fields = ("social_provider", "profile_image")
"social_provider", "profile_image", "has_password")
read_only_fields = ("social_provider", "profile_image", "has_password")
def get_has_password(self, obj):
"""사용자가 비밀번호를 가지고 있는지 여부"""
return obj.has_usable_password()
def validate_email(self, value):
if CustomUser.objects.filter(email=value).exists():