Private
Public Access
1
0

logging for NK auth

This commit is contained in:
2023-10-16 21:12:35 +02:00
parent 0c3de6fa56
commit 6954a144d6
3 changed files with 19 additions and 7 deletions

View File

@@ -224,6 +224,9 @@ class NKIntegration(SyncIntegration):
"redirect_uri": NK_REDIRECT_URI,
}
s = 'Authorizing NK for user {u}'.format(u = self.user.id)
dologging('nklog.log',s)
url = NK_OAUTH_LOCATION+"/oauth/authorize?"+urllib.parse.urlencode(params)
return url
@@ -237,14 +240,23 @@ class NKIntegration(SyncIntegration):
"code": code,
}
response = requests.post(
url,
auth=HTTPBasicAuth(self.oauth_data['client_id'],
self.oauth_data['client_secret']),
data=post_data
)
try:
response = requests.post(
url,
auth=HTTPBasicAuth(self.oauth_data['client_id'],
self.oauth_data['client_secret']),
data=post_data
)
except ConnectionError:
dologging('nklog.log','Connection error for user {u}'.format(u=self.user.id))
raise NoTokenError("Failed to obtain token")
if response.status_code != 200:
dologging('nklog.log','Response Status Code {c} for user {u}: {e}'.format(
u = self.user.id,
c = response.status_code,
e = response.text
))
raise NoTokenError("Failed to obtain token")
token_json = response.json()

View File

@@ -2,6 +2,6 @@
Hi {{ user.username }},
Please click on the link to confirm your registration,
http://{{ domain }}{% url 'useractivate' uidb64=uid token=token %}
https://{{ domain }}{% url 'useractivate' uidb64=uid token=token %}
If you think, it's not you, then just ignore this email.
{% endautoescape %}

Binary file not shown.