вернул всё обратно
This commit is contained in:
parent
7d6c91bd24
commit
3949be7303
|
|
@ -60,6 +60,15 @@ class MyUserViewSet(ViewSet):
|
|||
def update_user(self, request):
|
||||
password = request.user.password
|
||||
|
||||
if request.data['password'] == request.data['email']:
|
||||
return Response(
|
||||
{'detail': 'Почта не может являться паролем', 'error': {'email': 'Почта не может являться паролем'}},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if len(request.data['password']) < MIN_LEN_PASSWORD:
|
||||
return Response(
|
||||
{'detail': 'Минимальная длина - 8 символов', 'error': {'email': 'Минимальная длина - 8 символов'}},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if check_password(request.data['password'], password):
|
||||
return Response(
|
||||
|
|
@ -67,15 +76,6 @@ class MyUserViewSet(ViewSet):
|
|||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if check_password(request.data['old_password'], password):
|
||||
if request.data['password'] == request.data['email']:
|
||||
return Response(
|
||||
{'detail': 'Почта не может являться паролем', 'error': {'email': 'Почта не может являться паролем'}},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if len(request.data['password']) < MIN_LEN_PASSWORD:
|
||||
return Response(
|
||||
{'detail': 'Минимальная длина - 8 символов', 'error': {'email': 'Минимальная длина - 8 символов'}},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
if 'email' in request.data:
|
||||
del request.data['email']
|
||||
|
|
|
|||
Loading…
Reference in New Issue