|
|
|
@ -143,6 +143,9 @@ class DetailUserView(APIView): |
|
|
|
|
|
|
|
|
|
|
|
acc = request.JSON.get('account', None) |
|
|
|
acc = request.JSON.get('account', None) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b_date = datetime.datetime.strptime(acc['b_date'], '%d.%m.%Y') # TODO вынести форматы в настройки |
|
|
|
|
|
|
|
acc['b_date'] = b_date.strftime('%Y-%m-%d') |
|
|
|
|
|
|
|
|
|
|
|
acc['gender'] = 0 if acc['gender'] == "undefined" else 1 if acc['gender'] == "male" else 2 |
|
|
|
acc['gender'] = 0 if acc['gender'] == "undefined" else 1 if acc['gender'] == "male" else 2 |
|
|
|
|
|
|
|
|
|
|
|
if acc['photo']: |
|
|
|
if acc['photo']: |
|
|
|
@ -222,7 +225,7 @@ class ChangePasswordView(APIView): |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def post(request): |
|
|
|
def post(request): |
|
|
|
if request.user.is_authenticated() and not request.user.check_password(request.JSON['old_password']): |
|
|
|
if request.user.is_authenticated() or not request.user.check_password(request.JSON['old_password']): |
|
|
|
return Response("Неверный пароль", status=400) |
|
|
|
return Response("Неверный пароль", status=400) |
|
|
|
request.user.set_password(request.JSON['new_password']) |
|
|
|
request.user.set_password(request.JSON['new_password']) |
|
|
|
request.user.save() |
|
|
|
request.user.save() |
|
|
|
|