Skip to content

Commit

Permalink
Merge pull request #225 from PROCOLLAB-github/dev
Browse files Browse the repository at this point in the history
force verify route, fix deleting password from profile data
  • Loading branch information
Yakser authored Oct 28, 2023
2 parents 47756c0 + fc01fbc commit 4e641c2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions partner_programs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def post(self, request, *args, **kwargs):
data={"detail": "You need to pass an email address."},
status=status.HTTP_400_BAD_REQUEST,
)
password = data.get("password")
if not password:
return Response(
data={"detail": "You need to pass a password."},
status=status.HTTP_400_BAD_REQUEST,
)

user_fields = (
"first_name",
Expand All @@ -106,18 +112,11 @@ def post(self, request, *args, **kwargs):
status=status.HTTP_400_BAD_REQUEST,
)

password = data.get("password")
del data["password"]
if not password:
return Response(
data={"detail": "You need to pass a password."},
status=status.HTTP_400_BAD_REQUEST,
)
user.set_password(password)
user.save()

user_profile_program_data = {
k: v for k, v in data.items() if k not in user_fields
k: v for k, v in data.items() if k not in user_fields and k != "password"
}
PartnerProgramUserProfile.objects.create(
partner_program_data=user_profile_program_data,
Expand Down

0 comments on commit 4e641c2

Please sign in to comment.