Private
Public Access
1
0

adding link to update tokens

This commit is contained in:
2024-10-06 17:43:19 +02:00
parent 54d37322d4
commit 3c1b5fc07c
2 changed files with 26 additions and 19 deletions

View File

@@ -35,7 +35,7 @@
{% if rower.rojabo_token is not None and rower.rojabo_token != '' %} {% if rower.rojabo_token is not None and rower.rojabo_token != '' %}
Rojabo Rojabo
{% endif %} {% endif %}
</p> </p>
{% if form.errors %} {% if form.errors %}
@@ -44,13 +44,13 @@
</p> </p>
{% endif %} {% endif %}
<p> <p>
<form enctype="multipart/form-data" action="" method="post"> <form enctype="multipart/form-data" action="" method="post">
<table> <table>
{{ form.as_table }} {{ form.as_table }}
</table> </table>
{% csrf_token %} {% csrf_token %}
<input type="submit" value="Save"> <input type="submit" value="Save">
</form> </form>
</p> </p>
{% if rower.garmintoken and rower.garmintoken != '' %} {% if rower.garmintoken and rower.garmintoken != '' %}
<p> <p>
@@ -78,18 +78,21 @@
<p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNKLogbook.png" alt="connect with NK Logbook" width="120"></a></p> <p><a href="/rowers/me/nkauthorize/"><img src="/static/img/NKLiNKLogbook.png" alt="connect with NK Logbook" width="120"></a></p>
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p> <p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png" <p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
alt="connect with Polar" width="130"></a></p> alt="connect with Polar" width="130"></a></p>
<p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png" <p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
alt="connect with Polar" width="130"></a></p> alt="connect with Polar" width="130"></a></p>
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png" <p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
alt="connect with Garmin" width="130"></a></p> alt="connect with Garmin" width="130"></a></p>
<p><a href="/rowers/me/rp3authorize"><img src="/static/img/logo-rp3-full-black.png" <p><a href="/rowers/me/rp3authorize"><img src="/static/img/logo-rp3-full-black.png"
alt="connect with RP3" width="130"></a></p> alt="connect with RP3" width="130"></a></p>
<p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png" <p><a href="/rowers/me/rojaboauthorize"><img src="/static/img/rojabo.png"
alt="connect with Rojabo" width="130"></a></p> alt="connect with Rojabo" width="130"></a></p>
{% if user.is_staff %}
<p><a href="/rowers/me/fakturoidauthorize/"><img src="https://www.fakturoid.cz/images/svg/fakturoid-logo.svg" width="120"></a></p>
{% endif %}
{% endblock %} {% endblock %}
{% block sidebar %} {% block sidebar %}

View File

@@ -66,7 +66,6 @@ def rower_process_fakturoidcallback(request):
t.refresh_token = result['refresh_token'] t.refresh_token = result['refresh_token']
t.expires_in = result['expires_in'] t.expires_in = result['expires_in']
t.save() t.save()
print(t)
except FakturoidToken.DoesNotExist: except FakturoidToken.DoesNotExist:
t = FakturoidToken( t = FakturoidToken(
access_token = result['access_token'], access_token = result['access_token'],
@@ -74,9 +73,14 @@ def rower_process_fakturoidcallback(request):
expires_in = result['expires_in'], expires_in = result['expires_in'],
) )
t.save() t.save()
print(t) messages.info(request,"Token refreshed and stored")
else:
messages.error(request,"Error")
return HttpResponse('succes') url = reverse('rower_exportsettings_view')
return HttpResponseRedirect(url)
@csrf_exempt @csrf_exempt
def braintree_webhook_view(request): def braintree_webhook_view(request):