forked from github/plane
chore: serializer message change
This commit is contained in:
parent
97c215b70c
commit
318153652e
@ -159,10 +159,10 @@ class ChangePasswordSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
if data.get("old_password") == data.get("new_password"):
|
if data.get("old_password") == data.get("new_password"):
|
||||||
raise serializers.ValidationError("New password cannot be same as old password.")
|
raise serializers.ValidationError({"error": "New password cannot be same as old password."})
|
||||||
|
|
||||||
if data.get("new_password") != data.get("confirm_password"):
|
if data.get("new_password") != data.get("confirm_password"):
|
||||||
raise serializers.ValidationError("confirm password should be same as the new password.")
|
raise serializers.ValidationError({"error": "Confirm password should be same as the new password."})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class ChangePasswordEndpoint(BaseAPIView):
|
|||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
if not user.check_password(serializer.data.get("old_password")):
|
if not user.check_password(serializer.data.get("old_password")):
|
||||||
return Response(
|
return Response(
|
||||||
{"old_password": ["Wrong password."]},
|
{"error": "Old password is not correct"},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
# set_password also hashes the password that the user will get
|
# set_password also hashes the password that the user will get
|
||||||
|
Loading…
Reference in New Issue
Block a user