Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2020-01-07 13:59:40 +01:00
13 changed files with 289 additions and 145 deletions

View File

@@ -18,6 +18,7 @@ from iso8601 import ParseError
import numpy
import json
from json.decoder import JSONDecodeError
from rowsandall_app.settings import (
C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET

View File

@@ -1782,6 +1782,11 @@ def delete_strokedata(id):
dirname = 'media/strokedata_{id}.parquet.gz'.format(id=id)
try:
shutil.rmtree(dirname)
except OSError:
try:
os.remove(dirname)
except FileNotFoundError:
pass
except FileNotFoundError:
pass

View File

@@ -115,7 +115,6 @@ class EmailForm(forms.Form):
lastname = forms.CharField(max_length=255)
email = forms.EmailField()
subject = forms.CharField(max_length=255)
botcheck = forms.CharField(max_length=5)
message = forms.CharField()
disqualificationreasons = (

View File

@@ -3,115 +3,134 @@
{% block main %}
<h1>Contact us through email</h1>
<ul class="main-content">
<li class="grid_2">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<form method="post" action="/rowers/email/send/">{% csrf_token %}
<table>
<tr><td>
<label class="label">Name <span class="required">*</span></label>
<span class="span">
</td><td>
<input name= "firstname" class="inputtext" maxlength="255" size="12" />
<label class="spanlabel">First</label>
</td></tr>
<tr><td>
</span>
<span class="span">
</td><td>
<input name= "lastname" class="inputtext" maxlength="255" size="18" />
<label class="spanlabel">Last</label>
</span>
</td></tr>
<tr><td>
<label class="label">Email Address <span class="required">*</span></label>
</td><td>
<input name="email" class="inputtext" type="text" maxlength="255" size="35" />
</td></tr>
<tr><td>
<label class="label">Subject <span class="required">*</span></label>
</td><td>
<input name="subject" class="inputtext" type="text" maxlength="255" size="45" />
</td></tr>
</table>
<label class="label">You must answer <u>YES</u> to the question below to approve sending this email. <span class="required">*</span></label>
<table>
<tr><td>
Do you want to send me an email?
</td><td>
<input name="botcheck" class="inputtext" type="text" maxlength="5" size="5" />
</td></tr>
<tr><td>
<label class="label">Message <span class="required">*</span></label>
</td><td>
<textarea name="message" class="inputtextarea" rows="11" cols="45"></textarea>
</td></tr>
<tr><td>
<input type="submit" name="submitform" value="Send Message" />
</td></tr>
</table>
</form>
<li class="grid_2">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<form method="post" action="/rowers/email/send/" id="contactform">{% csrf_token %}
<p>
<table>
<tr><td>
<label>Name <span class="required">*</span></label>
<span class="span">
</td><td>
<input name= "firstname" class="inputtext" maxlength="255" size="12" />
<label>First</label>
</td></tr>
<tr><td>
</span>
<span class="span">
</td><td>
<input name= "lastname" class="inputtext" maxlength="255" size="18" />
<label>Last</label>
</span>
</td></tr>
<tr><td>
<label>Email Address <span class="required">*</span></label>
</td><td>
<input name="email" class="inputtext" type="text" maxlength="255" size="35" />
</td></tr>
<tr><td>
<label>Subject <span class="required">*</span></label>
</td><td>
<input name="subject" class="inputtext" type="text" maxlength="255" size="45" />
</td></tr>
</table>
<table>
<input type="hidden" name="g-recaptcha-response" id='recaptcha'>
</td></tr>
<tr><td>
<label>Message <span class="required">*</span></label>
</td><td>
<textarea name="message" class="inputtextarea" rows="11" cols="45"></textarea>
</td></tr>
<tr><td>
<input type="submit" name="submitform" value="Send Message" />
</td></tr>
</table>
</p>
</form>
</li>
<li class="grid_2">
<h1>Bug reporting, feature requests</h1>
<p>
Bug reports and feature requests can be done through our BitBucket page. Please check on the following link if your bug or issue is a known one. Feel free to file any feature request.
<ul>
<li><a href="https://bitbucket.org/sanderroosendaal/rowsandall/issues">BitBucket Issue list (click here to go report an issue or request a feature)</a></li>
</ul>
</p>
<h1>Bug reporting, feature requests</h1>
<p>
Bug reports and feature requests can be done through our BitBucket page. Please check on the following link if your bug or issue is a known one. Feel free to file any feature request.
<ul>
<li><a href="https://bitbucket.org/sanderroosendaal/rowsandall/issues">BitBucket Issue list (click here to go report an issue or request a feature)</a></li>
</ul>
</p>
</li>
<li class="grid_2">
<h1>Facebook Group</h1>
<p>We run a facebook group where you can post questions and report problems,
especially if you think the wider user community benefits from the answers.</p>
<ul>
<li><a href="https://www.facebook.com/groups/rowsandall/">https://www.facebook.com/groups/rowsandall/</a></li>
</ul>
</li>
<h1>Facebook Group</h1>
<li class="grid_2">
<h1>Twitter</h1>
<p>You can also check me on Twitter:
<ul>
<li><a href="https://twitter.com/rowsandall">https://twitter.com/rowsandall</a>
</ul>
When the site is down, this is the appropriate channel to look for apologies, updates, and offer help.
</p>
</li>
<p>We run a facebook group where you can post questions and report problems,
especially if you think the wider user community benefits from the answers.</p>
<ul>
<li><a href="https://www.facebook.com/groups/rowsandall/">https://www.facebook.com/groups/rowsandall/</a></li>
</ul>
</li>
<li class="grid_2">
<h1>Rowsandall s.r.o.</h1>
<p><strong>Rowsandall s.r.o.</strong><br />
Nov&eacute; sady 988/2<br />
602 00 Brno<br />
Czech Republic<br />
IČ: 070 48 572<br />
DIČ: CZ 070 48 572 (Nejsme plátce DPH)<br />
Datová schránka: 7897syr<br />
Email: <a href="mailto:info@rowsandall.com">info@rowsandall.com</a><br />
The company is registered in the business register at the
Regional Court in Brno (Společnost je zapsána v obchodním rejstříku vedeném u Krajského soudu v Brně, oddíl C, vložka 105845)<br/>
</p>
<li class="grid_2">
<h1>Twitter</h1>
</li>
</ul>
{% endblock %}
<p>You can also check me on Twitter:
<ul>
<li><a href="https://twitter.com/rowsandall">https://twitter.com/rowsandall</a>
</ul>
When the site is down, this is the appropriate channel to look for apologies, updates, and offer help.
</p>
</li>
{% block sidebar %}
{% include 'menu_help.html' %}
{% endblock %}
<li class="grid_2">
<h1>Rowsandall s.r.o.</h1>
<p><strong>Rowsandall s.r.o.</strong><br />
Nov&eacute; sady 988/2<br />
602 00 Brno<br />
Czech Republic<br />
IČ: 070 48 572<br />
DIČ: CZ 070 48 572 (Nejsme plátce DPH)<br />
Datová schránka: 7897syr<br />
Email: <a href="mailto:info@rowsandall.com">info@rowsandall.com</a><br />
The company is registered in the business register at the
Regional Court in Brno (Společnost je zapsána v obchodním rejstříku vedeném u Krajského soudu v Brně, oddíl C, vložka 105845)<br/>
</p>
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'menu_help.html' %}
{% endblock %}
{% block scripts %}
<script src="https://www.google.com/recaptcha/api.js?render=6LdRtMwUAAAAAGcKcFc28pGvmEb1wwDY27i0AX8B"></script>
<script>
// 3
grecaptcha.ready(function() {
// 4
$('#contactform').submit(function(e){
var form = this;
// 5
e.preventDefault()
grecaptcha.execute('6LdRtMwUAAAAAGcKcFc28pGvmEb1wwDY27i0AX8B', {action: 'contactform'}).then(function(token) {
// 6
$('#recaptcha').val(token)
// 7
form.submit()
});
})
});
</script>
{% endblock %}

View File

@@ -7,6 +7,17 @@
Thank you. We have received the payment of &euro; {{ amount }} for Rowsandall related services.
</p>
<p>
With your contribution, you are helping to keep this service to the rowing community
running. As the founder and developer of the Rowsandall.com site I am very interested
to know what you think of Rowsandall.com, as well as suggestions for improvements.
</p>
<p>
So don't hesitate to respond to this email and let me know. I will read and respond to each
email.
</p>
<p>
Please contact our customer service by replying to this email if you have any further
questions regarding the payment.
@@ -16,4 +27,3 @@
Best Regards, the Rowsandall Team
</p>
{% endblock %}

View File

@@ -0,0 +1,31 @@
{% extends "emailbase.html" %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>
<p>
Welcome on the trial for the Self-Coach plan.
</p>
<p>
As the developer of the Rowsandall.com site I am very interested to know what you think of Rowsandall.com. Especially, I'd like to understand how you started using the site, what you are looking for, and what you think could be improved.
</p>
<p>
The Self-Coach functionality allows you to create training plans and sessions for you and your training group. Feel free to contact me any time you need help.
</p>
<p>
I'd also love to hear a bit about your rowing background.
</p>
<p>
So don't hesitate to respond to this email and let me know. I will read and respond to each
email.
</p>
<p>
Thank you very much for your help and for supporting <a href="rowsandall.com">rowsandall.com</a>.
</p>
<p>
Best Regards, the Rowsandall Team
</p>
{% endblock %}

View File

@@ -0,0 +1,33 @@
{% extends "emailbase.html" %}
{% block body %}
<p>Dear <strong>{{ first_name }}</strong>,</p>
<p>
Welcome on the trial for the Pro plan.
</p>
<p>
As the developer of the Rowsandall.com site I am very interested to know
what you think of Rowsandall.com.
Especially, I'd like to understand how you started using the site,
what you are looking for, and what you think could be improved.
</p>
<p>
I'd also love to hear a bit about your rowing background.
</p>
<p>
So don't hesitate to respond to this email and let me know. I will read and respond to each
email.
</p>
<p>
Thank you very much for your help and for supporting <a href="rowsandall.com">rowsandall.com</a>.
</p>
<p>
Best Regards, the Rowsandall Team
</p>
{% endblock %}

View File

@@ -5,22 +5,34 @@
<p>
Thank you. We have received the payment of &euro; {{ amount }} for
your updated Rowsandall subscription.
You are now on the Rowsandall paid plan "{{ planname }}".
your updated Rowsandall subscription.
You are now on the Rowsandall paid plan "{{ planname }}".
</p>
<p>
With your contribution, you are helping to keep this service to the rowing community
running. As the founder and developer of the Rowsandall.com site I am very interested
to know what you think of Rowsandall.com, as well as suggestions for improvements.
</p>
<p>
So don't hesitate to respond to this email and let me know. I will read and respond to each
email.
</p>
{% if recurring=='recurring' %}
<p>
Some more information about the subscription.
The subscription cost is &euro;{{ price }} per year.
Your next charge is due on {{ end_of_billing_period }}. We will charge you automatically
on that date.
on that date.
</p>
<p>
The subscription will keep running until you change or stop it. At any point in time you
can change the automatically renewing subscription to a "one year only" subscription through
<a href="{{ siteurl}}/rowers/upgrade/">the upgrade page</a>. On this page, you can also
upgrade your subscription.
upgrade your subscription.
</p>
{% else %}
@@ -28,7 +40,7 @@
The price of the subscription is &euro;{{ price }}. You have paid &euro;{{ amount }} as a
prorated cost of your upgrade.
This one year subscription will automatically end on {{ end_of_billing_period }}. You can
renew your subscription after that.
renew your subscription after that.
</p>
<p>
@@ -60,4 +72,3 @@
Best Regards, the Rowsandall Team
</p>
{% endblock %}

View File

@@ -158,7 +158,8 @@ from rowsandall_app.settings import (
RUNKEEPER_CLIENT_ID,RUNKEEPER_REDIRECT_URI,RUNKEEPER_CLIENT_SECRET,
TP_CLIENT_ID,TP_REDIRECT_URI,TP_CLIENT_KEY,TP_CLIENT_SECRET,
BRAINTREE_MERCHANT_ID,BRAINTREE_PUBLIC_KEY,BRAINTREE_PRIVATE_KEY,
PAYMENT_PROCESSING_ON
PAYMENT_PROCESSING_ON,
RECAPTCHA_SITE_KEY, RECAPTCHA_SITE_SECRET
)
#from rowers.tasks_standalone import addcomment2
@@ -1073,28 +1074,39 @@ def add_defaultfavorites(r):
f.save()
return 1
# Shows email form and sends it if submitted
def sendmail(request):
if request.method == 'POST':
# test recaptcha
response_string = request.POST.get('g-recaptcha-response')
# replace below with settings
recaptcha_secret = RECAPTCHA_SITE_SECRET
url = 'https://www.google.com/recaptcha/api/siteverify'
data = {
'secret':recaptcha_secret,
'response': response_string,
}
response = requests.post(url,data=data,verify=True)
success = False
if response.status_code == 200:
success = response.json().get('success')
form = EmailForm(request.POST)
if form.is_valid():
if form.is_valid() and success:
firstname = form.cleaned_data['firstname']
lastname = form.cleaned_data['lastname']
email = form.cleaned_data['email']
subject = form.cleaned_data['subject']
botcheck = form.cleaned_data['botcheck'].lower()
subject = 'Rowsandall Contact Form:'+form.cleaned_data['subject']
message = form.cleaned_data['message']
if botcheck == 'yes':
try:
fullemail = firstname + " " + lastname + " " + "<" + email + ">"
send_mail(subject, message, fullemail, ['info@rowsandall.com'])
return HttpResponseRedirect('/rowers/email/thankyou/')
except:
return HttpResponseRedirect('/rowers/email/')
else:
messages.error(request,'You have to answer YES to the question')
return HttpResponseRedirect('/rowers/email/')
fullemail = firstname + " " + lastname + " " + "<" + email + ">"
send_mail(subject, message, fullemail, ['info@rowsandall.com'])
return HttpResponseRedirect('/rowers/email/thankyou/')
else:
if not success:
messages.error(request,'Bots are not welcome')
else:
messages.error(request,'Something went wrong. Please try again')
return HttpResponseRedirect('/rowers/email/')
else:
return HttpResponseRedirect('/rowers/email/')

View File

@@ -13,23 +13,30 @@ def start_trial_view(request):
messages.error(request,'You do not qualify for a trial')
url = '/rowers/paidplans'
return HttpResponseRedirect(url)
r.protrialexpires = datetime.date.today()+datetime.timedelta(13)
r.save()
url = reverse('workouts_view')
messages.info(request,'We have started your 14 day trial period')
subject2 = "User started Pro Trial"
message2 = "User Started Pro Trial.\n"
message2 += request.user.email + "\n"
message2 += "User name: "+request.user.username
send_mail(subject2, message2,
'Rowsandall Server <info@rowsandall.com>',
['roosendaalsander@gmail.com'])
send_template_email('Rowsandall <info@rowsandall.com>',
[r.user.email],
'Welcome to the Rowsandall Pro Trial',
'protrialewelcome.html',
{'first_name':r.user.first_name,
'last_name':r.user.last_name})
return HttpResponseRedirect(url)
@login_required()
@@ -40,7 +47,7 @@ def start_plantrial_view(request):
messages.error(request,'You do not qualify for a trial')
url = '/rowers/paidplans'
return HttpResponseRedirect(url)
r.plantrialexpires = datetime.date.today()+datetime.timedelta(13)
r.protrialexpires = datetime.date.today()+datetime.timedelta(13)
r.save()
@@ -48,16 +55,23 @@ def start_plantrial_view(request):
url = reverse('workouts_view')
messages.info(request,'We have started your 14 day trial period')
subject2 = "User started Plan Trial"
message2 = "User Started Plan Trial.\n"
message2 += request.user.email + "\n"
message2 += "User name: "+request.user.username
send_mail(subject2, message2,
'Rowsandall Server <info@rowsandall.com>',
['roosendaalsander@gmail.com'])
send_template_email('Rowsandall <info@rowsandall.com>',
[r.user.email],
'Welcome to the Rowsandall Self-Coach Trial',
'plantrialwelcome.html',
{'first_name':r.user.first_name,
'last_name':r.user.last_name})
return HttpResponseRedirect(url)
# Page where user can manage his favorite charts
@@ -79,7 +93,7 @@ def rower_favoritecharts_view(request,userid=0):
FavoriteChartFormSet = formset_factory(FavoriteForm,formset=BaseFavoriteFormSet,extra=0)
if aantal==0:
FavoriteChartFormSet = formset_factory(FavoriteForm,formset=BaseFavoriteFormSet,extra=1)
if request.method == 'POST':
favorites_formset = FavoriteChartFormSet(request.POST)
@@ -115,7 +129,7 @@ def rower_favoritecharts_view(request,userid=0):
messages.error(request,message)
else:
favorites_formset = FavoriteChartFormSet(initial=favorites_data)
context = {
'favorites_formset':favorites_formset,
@@ -123,8 +137,8 @@ def rower_favoritecharts_view(request,userid=0):
'rower':r,
}
return render(request,'favoritecharts.html',context)
# page where user sets his export settings
@@ -154,7 +168,7 @@ def rower_exportsettings_view(request,userid=0):
'name': 'Export Settings'
}
]
return render(request, 'rower_exportsettings.html',
{'form':form,
'rower':r,
@@ -367,7 +381,7 @@ def rower_prefs_view(request,userid=0,message=""):
'rower':r,
})
# Revoke an app that you granted access through the API.
# this views is called when you press a button on the User edit page
# the button is only there when you have granted access to an app
@@ -401,7 +415,7 @@ def rower_update_empower_view(
r = getrower(request.user)
except Rower.DoesNotExist:
raise Http404("Rower doesn't exist")
if request.method == 'POST' and 'daterange' in request.POST:
dateform = DateRangeForm(request.POST)
if dateform.is_valid():
@@ -416,7 +430,7 @@ def rower_update_empower_view(
'startdate':startdate,
'enddate':enddate,
})
if request.method == 'POST' and 'workouts' in request.POST:
form = WorkoutMultipleCompareForm(request.POST)
@@ -424,7 +438,7 @@ def rower_update_empower_view(
cd = form.cleaned_data
workouts = cd['workouts']
workoutdicts = []
for w in workouts:
if w.user != r:
message = "You can only alter your own workouts"
@@ -440,7 +454,7 @@ def rower_update_empower_view(
messages.error(request,message)
else:
workoutdict = {
'id':w.id,
'boattype':w.boattype,
@@ -454,7 +468,7 @@ def rower_update_empower_view(
w.workoutsource = 'speedcoach2corrected'
w.save()
job = myqueue(queuelow,handle_update_empower,
request.user.email,workoutdicts,
debug=False,
@@ -479,7 +493,7 @@ def rower_update_empower_view(
workoutsource='speedcoach2',
user=r,
).order_by("-date","-starttime")
form = WorkoutMultipleCompareForm()
form.fields["workouts"].queryset = workouts
# GET request = prepare form
@@ -491,5 +505,3 @@ def rower_update_empower_view(
'form':form,
'rower':r
})

View File

@@ -494,3 +494,13 @@ try:
CELERY = CFG['use_celery']
except KeyError:
CELERY = False
# Recaptcha
try:
RECAPTCHA_SITE_KEY = CFG['recaptcha_site_key']
RECAPTCHA_SITE_SECRET = CFG['recaptcha_site_secret']
except KeyError:
RECAPTCHA_SITE_KEY = ''
RECAPTCHA_SITE_SECRET = ''

View File

@@ -60,7 +60,7 @@ DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
ALLOWED_HOSTS = ['localhost']
ALLOWED_HOSTS = ['localhost','127.0.0.1']
# INSTALLED_APPS += ['debug_toolbar',]

View File

@@ -48,6 +48,7 @@
<link rel="stylesheet" href="/static/css/rowsandall2.min.css" />
{% block meta %} {% endblock %}
<div id="fb-root"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;