Skip to content

Commit 4fb78b1

Browse files
committed
Fix password hashing in PartnerProgramCreateUserAndRegister view
Should be refactored
1 parent 42028b1 commit 4fb78b1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

partner_programs/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def post(self, request, *args, **kwargs):
7171
print(data)
7272
user_fields = (
7373
# "email",
74-
"password",
74+
# "password",
7575
"first_name",
7676
"last_name",
7777
"patronymic",
@@ -95,6 +95,15 @@ def post(self, request, *args, **kwargs):
9595
onboarding_stage=None, # bypass onboarding
9696
email=email,
9797
)
98+
# fixme: какое же дерьмо в этой вьюшке творится, извините я поправлю после дедлайна
99+
password = data.get("password")
100+
if not password:
101+
return Response(
102+
data={"detail": "You need to pass a password."},
103+
status=status.HTTP_400_BAD_REQUEST,
104+
)
105+
user.set_password(password)
106+
user.save()
98107

99108
user_profile_program_data = {
100109
field_name: data.get(field_name)

0 commit comments

Comments
 (0)