logging for NK auth
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
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