logging for NK auth
This commit is contained in:
@@ -224,6 +224,9 @@ class NKIntegration(SyncIntegration):
|
|||||||
"redirect_uri": NK_REDIRECT_URI,
|
"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)
|
url = NK_OAUTH_LOCATION+"/oauth/authorize?"+urllib.parse.urlencode(params)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
@@ -237,14 +240,23 @@ class NKIntegration(SyncIntegration):
|
|||||||
"code": code,
|
"code": code,
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post(
|
try:
|
||||||
url,
|
response = requests.post(
|
||||||
auth=HTTPBasicAuth(self.oauth_data['client_id'],
|
url,
|
||||||
self.oauth_data['client_secret']),
|
auth=HTTPBasicAuth(self.oauth_data['client_id'],
|
||||||
data=post_data
|
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:
|
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")
|
raise NoTokenError("Failed to obtain token")
|
||||||
|
|
||||||
token_json = response.json()
|
token_json = response.json()
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
Hi {{ user.username }},
|
Hi {{ user.username }},
|
||||||
Please click on the link to confirm your registration,
|
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.
|
If you think, it's not you, then just ignore this email.
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user