Private
Public Access
1
0
This commit is contained in:
2023-08-04 16:56:51 +02:00
parent c095662999
commit a241ca24c7
3 changed files with 33 additions and 10 deletions

View File

@@ -81,6 +81,8 @@ def rower_integration_authorize(request, source='c2'):
return rower_garmin_authorize(request)
if source == 'rojabo':
return rower_rojabo_authorize(request)
if source == 'polar':
return rower_polar_authorize(request)
url = integration.make_authorization_url()
return HttpResponseRedirect(url)
@@ -96,7 +98,7 @@ def rower_garmin_authorize(request): # pragma: no cover
# Polar Authorization
@login_required()
def rower_polar_authorize(request): # pragma: no cover
def rower_polar_authorize(request, source='polar'): # pragma: no cover
integration = importsources['polar'](request.user)
url = integration.make_authorization_url()
return HttpResponseRedirect(url)
@@ -372,7 +374,11 @@ def workout_import_view(request, source='c2'):
_ = integration.open()
except NoTokenError: # pragma: no cover
try:
url = reverse(importauthorizeviews[source],kwargs={'source':source})
theview = importauthorizeviews[source]
if theview == 'rower_integration_authorize':
url = reverse(theview,kwargs={'source':source})
else:
url = reverse(theview)
return HttpResponseRedirect(url)
except KeyError:
messages.error(request,'Sorry, an error occurred. Please reauthorize')