From ec5e8d4230d3acc8adee0620afd7b88ba20edadd Mon Sep 17 00:00:00 2001 From: alice Date: Tue, 29 Dec 2020 17:11:37 +0100 Subject: [PATCH] trial on signup --- ccvpn/settings.py | 1 + lambdainst/views.py | 4 ++++ templates/lambdainst/account.html | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ccvpn/settings.py b/ccvpn/settings.py index f401731..22e8d9a 100644 --- a/ccvpn/settings.py +++ b/ccvpn/settings.py @@ -299,6 +299,7 @@ CONSTANCE_CONFIG = { 'WIREGUARD_PUBKEY': ("", "WireGuard server public key"), 'WIREGUARD_PSK': ("", "WireGuard pre-shared key (optional)"), 'WIREGUARD_DNS': ("10.128.0.1", "WireGuard DNS server IP address"), + 'TRIAL_ON_SIGNUP': (6, "Hours of trial to give on signup"), } CONSTANCE_ADDITIONAL_FIELDS = { diff --git a/lambdainst/views.py b/lambdainst/views.py index 246236c..0ee162e 100644 --- a/lambdainst/views.py +++ b/lambdainst/views.py @@ -93,6 +93,10 @@ def signup(request): user.vpnuser.campaign = request.session.get('campaign') + if site_config.TRIAL_ON_SIGNUP: + trial_time = timedelta(hours=site_config.TRIAL_ON_SIGNUP) + user.vpnuser.add_paid_time(trial_time) + user.vpnuser.save() user.vpnuser.lcore_sync() diff --git a/templates/lambdainst/account.html b/templates/lambdainst/account.html index e0b4690..2f7e97f 100644 --- a/templates/lambdainst/account.html +++ b/templates/lambdainst/account.html @@ -167,7 +167,7 @@

{% blocktrans trimmed with left=user.vpnuser. %} - For up to one week, you can activate your free trial for the next two hours by clicking on this button: + For up to one week, you can activate your free trial for two hours by clicking on this button: {% endblocktrans %}