Skip to content

Commit 4e641c2

Browse files
authored
Merge pull request #225 from PROCOLLAB-github/dev
force verify route, fix deleting password from profile data
2 parents 47756c0 + fc01fbc commit 4e641c2

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

partner_programs/views.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ def post(self, request, *args, **kwargs):
8484
data={"detail": "You need to pass an email address."},
8585
status=status.HTTP_400_BAD_REQUEST,
8686
)
87+
password = data.get("password")
88+
if not password:
89+
return Response(
90+
data={"detail": "You need to pass a password."},
91+
status=status.HTTP_400_BAD_REQUEST,
92+
)
8793

8894
user_fields = (
8995
"first_name",
@@ -106,18 +112,11 @@ def post(self, request, *args, **kwargs):
106112
status=status.HTTP_400_BAD_REQUEST,
107113
)
108114

109-
password = data.get("password")
110-
del data["password"]
111-
if not password:
112-
return Response(
113-
data={"detail": "You need to pass a password."},
114-
status=status.HTTP_400_BAD_REQUEST,
115-
)
116115
user.set_password(password)
117116
user.save()
118117

119118
user_profile_program_data = {
120-
k: v for k, v in data.items() if k not in user_fields
119+
k: v for k, v in data.items() if k not in user_fields and k != "password"
121120
}
122121
PartnerProgramUserProfile.objects.create(
123122
partner_program_data=user_profile_program_data,

0 commit comments

Comments
 (0)