From f5d6e953a5c8d481e4da5baebc8f31335d8bea02 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sat, 2 Apr 2022 19:22:25 +0300 Subject: [PATCH] version --- Main/views/social/VKAddView.py | 2 +- Main/views/social/VKAuthView.py | 2 +- templates/account.html | 26 ++++++++++++++------------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Main/views/social/VKAddView.py b/Main/views/social/VKAddView.py index 2e9b007..d27e73e 100644 --- a/Main/views/social/VKAddView.py +++ b/Main/views/social/VKAddView.py @@ -22,7 +22,7 @@ class VKAddView(BaseView): resp = get(f'https://api.vk.com/method/secure.checkToken?token={access_token}&access_token={token}&v=5.131').json() print("Got response while adding user", resp) if 'response' in resp and 'success' in resp['response'] and resp['response']['success'] == 1: - user_id = resp['user_id'] + user_id = resp['response']['user_id'] self.request.user.userinfo.vk_user_id = user_id self.request.user.userinfo.save() return '/account' diff --git a/Main/views/social/VKAuthView.py b/Main/views/social/VKAuthView.py index 12e0409..eac6d1b 100644 --- a/Main/views/social/VKAuthView.py +++ b/Main/views/social/VKAuthView.py @@ -21,7 +21,7 @@ class VKAuthView(BaseView): token = os.getenv("VK_SERVICE_TOKEN") resp = get(f'https://api.vk.com/method/secure.checkToken?token={access_token}&access_token={token}&v=5.131').json() if 'response' in resp and 'success' in resp['response'] and resp['response']['success'] == 1: - user_id = resp['user_id'] + user_id = resp['response']['user_id'] try: user = User.objects.get(userinfo__vk_user_id=user_id) except ObjectDoesNotExist: diff --git a/templates/account.html b/templates/account.html index 517f81f..415cca7 100644 --- a/templates/account.html +++ b/templates/account.html @@ -85,17 +85,6 @@

{{ account.date_joined.date }}

- {% if account == user %} - - -

- -
- - - - - {% endif %}

@@ -122,7 +111,20 @@ {% endif %}

- + {% if owner %} + + +

+ +
+ + + {% if user.userinfo.vk_user_id %} +
+ {% endif %} + + + {% endif %}