diff --git a/rowers/templates/rower_exportsettings.html b/rowers/templates/rower_exportsettings.html index a62ad6a2..4990ce37 100644 --- a/rowers/templates/rower_exportsettings.html +++ b/rowers/templates/rower_exportsettings.html @@ -7,37 +7,38 @@ {% block main %}

Import and Export Settings for {{ rower.user.first_name }} {{ rower.user.last_name }}

-

You are currently connected to: - {% if rower.c2token is not None and rower.c2token != '' %} - Concept2 Logbook, - {% endif %} - {% if rower.nktoken is not None and rower.nktoken != '' %} - NK Logbook, - {% endif %} - {% if rower.sporttrackstoken is not None and rower.sporttrackstoken != '' %} - SportTracks, - {% endif %} - {% if rower.tptoken is not None and rower.tptoken != '' %} - TrainingPeaks, - {% endif %} - {% if rower.polartoken is not None and rower.polartoken != '' %} - Polar, - {% endif %} - {% if rower.garmintoken is not None and rower.garmintoken != '' %} - Garmin Connect, - {% endif %} - {% if rower.stravatoken is not None and rower.stravatoken != '' %} - Strava, - {% endif %} - {% if rower.rp3token is not None and rower.rp3token != '' %} - RP3 - {% endif %} - {% if rower.rojabo_token is not None and rower.rojabo_token != '' %} - Rojabo - {% endif %} - -

- +
    +
  • +

    You are currently connected to: + {% if rower.c2token is not None and rower.c2token != '' %} + Concept2 Logbook, + {% endif %} + {% if rower.nktoken is not None and rower.nktoken != '' %} + NK Logbook, + {% endif %} + {% if rower.sporttrackstoken is not None and rower.sporttrackstoken != '' %} + SportTracks, + {% endif %} + {% if rower.tptoken is not None and rower.tptoken != '' %} + TrainingPeaks, + {% endif %} + {% if rower.polartoken is not None and rower.polartoken != '' %} + Polar, + {% endif %} + {% if rower.garmintoken is not None and rower.garmintoken != '' %} + Garmin Connect, + {% endif %} + {% if rower.stravatoken is not None and rower.stravatoken != '' %} + Strava, + {% endif %} + {% if rower.rp3token is not None and rower.rp3token != '' %} + RP3 + {% endif %} + {% if rower.rojabo_token is not None and rower.rojabo_token != '' %} + Rojabo + {% endif %} +

    + {% if form.errors %}

    Please correct the error{{ form.errors|pluralize }} below. @@ -71,24 +72,57 @@ a workout on Strava. If you want Deletions to propagate to Rowsandall, tick the Strava Auto Delete check box.

    -

    Click on one of the icons below to connect to the service of your - choice or to renew the authorization.

    -

    connect with strava

    -

    connect with Concept2

    -

    connect with NK Logbook

    -

    connect with SportTracks

    -

    +

  • + {% if grants %} +

    Applications

    + + + + + + + + + + {% for grant in grants %} + + + + + + {% endfor %} + +
    ApplicationScopeRevoke
    {{ grant.application }}{{ grant.scope }} + Revoke +
    + {% endif %} +

    API Key

    +

    {{ apikey }}

    +

    + Regenerate +

    + This API key can be used to access the Rowsandall API. It is used by some third party applications to access your data. Keep it secret. +
  • + +
+

Click on one of the icons below to connect to the service of your + choice or to renew the authorization.

+

connect with strava

+

connect with Concept2

+

connect with NK Logbook

+

connect with SportTracks

+

connect with Polar

-

connect with Polar

- -

connect with Garmin

-

connect with RP3

-

connect with Rojabo

- +

connect with Polar

+ +

connect with Garmin

+

connect with RP3

+

connect with Rojabo

{% endblock %} diff --git a/rowers/views/userviews.py b/rowers/views/userviews.py index 250a5432..e92af908 100644 --- a/rowers/views/userviews.py +++ b/rowers/views/userviews.py @@ -520,10 +520,19 @@ def rower_exportsettings_view(request, userid=0): } ] + grants = AccessToken.objects.filter(user=request.user) + try: + apikey = APIKey.objects.get(user=request.user) + except APIKey.DoesNotExist: + apikey = APIKey.objects.create(user=request.user) + + return render(request, 'rower_exportsettings.html', {'form': form, 'rower': r, 'breadcrumbs': breadcrumbs, + 'grants': grants, + 'apikey': apikey.key, }) @@ -651,6 +660,7 @@ def rower_edit_view(request, rowerid=0, userid=0, message=""): @login_required() def rower_regenerate_apikey(request): + referer = request.META['HTTP_REFERER'] try: apikey = APIKey.objects.get(user=request.user) except APIKey.DoesNotExist: @@ -658,7 +668,7 @@ def rower_regenerate_apikey(request): apikey.regenerate_key() - return HttpResponseRedirect(reverse('rower_edit_view')) + return HttpResponseRedirect(referer) #simple initial settings page @login_required()