Skip to content

Commit

Permalink
fix reset password, gunicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
MafanNam committed Dec 25, 2023
1 parent e5af51a commit efac630
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion clone_sound_cloud/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
'USERNAME_RESET_CONFIRM_URL': 'username/reset/confirm/{uid}/{token}',
'SOCIAL_AUTH_TOKEN_STRATEGY': 'djoser.social.token.jwt.TokenStrategy',
'SOCIAL_AUTH_ALLOWED_REDIRECT_URIS': [
'http://127.0.0.1:0000', 'http://localhost:8000'],
'http://127.0.0.1:0000', 'http://localhost:8000', 'http://localhost'],
'ACTIVATION_URL': 'activate/{uid}/{token}',
'SERIALIZERS': {
'user_create': 'oauth.api.serializers.CustomUserCreateSerializer',
Expand All @@ -199,6 +199,8 @@
'username_changed_confirmation': 'oauth.email.UsernameChangedConfirmationEmail',
'username_reset': 'oauth.email.UsernameResetEmail',
},
'PASSWORD_RESET_SHOW_EMAIL_NOT_FOUND': True,
'USERNAME_RESET_SHOW_EMAIL_NOT_FOUND': True,
}

SPECTACULAR_SETTINGS = {
Expand Down
8 changes: 6 additions & 2 deletions clone_sound_cloud/oauth/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def reset_password(self, request, *args, **kwargs):
'site_name': self.request.get_host()
}
send_email_celery_task.delay(context, email_to, 'PasswordResetEmail')

return Response(status=status.HTTP_204_NO_CONTENT)

@action(["post"], detail=False)
Expand All @@ -222,6 +221,8 @@ def reset_password_confirm(self, request, *args, **kwargs):

@action(["post"], detail=False, url_path=f"set_{User.USERNAME_FIELD}")
def set_username(self, request, *args, **kwargs):
"""NOT WORKING !!!"""

serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
user = self.request.user
Expand All @@ -242,6 +243,8 @@ def set_username(self, request, *args, **kwargs):

@action(["post"], detail=False, url_path=f"reset_{User.USERNAME_FIELD}")
def reset_username(self, request, *args, **kwargs):
"""NOT WORKING !!!"""

serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
user = serializer.get_user()
Expand All @@ -255,11 +258,12 @@ def reset_username(self, request, *args, **kwargs):
'site_name': self.request.get_host()
}
send_email_celery_task.delay(context, email_to, 'UsernameResetEmail')

return Response(status=status.HTTP_204_NO_CONTENT)

@action(["post"], detail=False, url_path=f"reset_{User.USERNAME_FIELD}_confirm")
def reset_username_confirm(self, request, *args, **kwargs):
"""NOT WORKING !!!"""

serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
new_username = serializer.data["new_" + User.USERNAME_FIELD]
Expand Down
2 changes: 1 addition & 1 deletion docker/backend/server-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ python manage.py collectstatic --noinput

python manage.py createsuperuser --noinput

#gunicorn backend.wsgi --bind 0.0.0.0:8000 --workers 4 --threads 4
#gunicorn config.wsgi --bind 0.0.0.0:8000 --workers 4 --threads 4

# for debug
python manage.py runserver 0.0.0.0:8000

0 comments on commit efac630

Please sign in to comment.