make trial implicit & effective on registration

master
alice 4 years ago
parent 6c130eaca0
commit 70e0fd7123

@ -99,7 +99,7 @@ setup_sync_hooks(User, VPNUser)
@receiver(post_save, sender=User) @receiver(post_save, sender=User)
def create_vpnuser(sender, instance, created, **kwargs): def create_vpnuser(sender, instance, created, **kwargs):
if created: if created and not instance.vpnuser:
VPNUser.objects.create(user=instance) VPNUser.objects.create(user=instance)

@ -94,6 +94,7 @@ def signup(request):
pass pass
user.vpnuser.campaign = request.session.get('campaign') user.vpnuser.campaign = request.session.get('campaign')
user.vpnuser.add_paid_time(timedelta(days=7))
if site_config.TRIAL_ON_SIGNUP: if site_config.TRIAL_ON_SIGNUP:
trial_time = timedelta(hours=site_config.TRIAL_ON_SIGNUP) trial_time = timedelta(hours=site_config.TRIAL_ON_SIGNUP)

@ -166,30 +166,10 @@
</div> </div>
{% endif %} {% endif %}
{% if user.vpnuser.can_have_trial %}
<div class="content-box account-trial">
<p>
{% blocktrans trimmed with left=user.vpnuser. %}
For up to one week, you can activate your free trial for two hours by clicking on this button:
{% endblocktrans %}
</p>
<form action="/account/trial" method="post" class="pure-form" name="trial_form">
{% csrf_token %}
<div class="h-captcha" data-sitekey="{{ hcaptcha_site_key }}" data-callback="onCaptcha"></div>
<script src="https://hcaptcha.com/1/api.js" async defer></script>
<script>
function onCaptcha(v) {
document.forms.trial_form.submit();
}
</script>
</form>
</div>
{% endif %}
<div class="account-aff-box"> <div class="account-aff-box">
<p> <p>
{% blocktrans trimmed %} {% blocktrans trimmed %}
Get two weeks for free for every referral that takes at least one month! Get two weeks for free for every referral that subscribes for any amount of time!
{% endblocktrans %} {% endblocktrans %}
{% trans 'Share this link' %}: {% trans 'Share this link' %}:
<form class="pure-form"> <form class="pure-form">

Loading…
Cancel
Save