Browse Source

warn on renewal issues

master
alice 3 days ago
parent
commit
a1ba371f41
4 changed files with 68 additions and 60 deletions
  1. +9
    -0
      lambdainst/models.py
  2. +0
    -10
      lambdainst/views.py
  3. +51
    -47
      locale/fr/LC_MESSAGES/django.po
  4. +8
    -3
      templates/lambdainst/account.html

+ 9
- 0
lambdainst/models.py View File

@@ -1,7 +1,9 @@
import random
from datetime import timedelta
from django.db import models, IntegrityError
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils import timezone
from django_lcore.core import (
LcoreUserProfileMethods,
setup_sync_hooks,
@@ -63,6 +65,13 @@ class VPNUser(models.Model, BaseSubUser, LcoreUserProfileMethods):
self.referrer_used = True
self.save()

@property
def subscr_is_failing(self):
margin = timedelta(hours=24)
if self.expiration < timezone.now() + margin:
return True
return False

def lcore_sync(self):
if VPN_AUTH_STORAGE == "inst":
return


+ 0
- 10
lambdainst/views.py View File

@@ -182,14 +182,6 @@ def discourse_login(request):
def index(request):
ref_url = project_settings.ROOT_URL + "?ref=" + str(request.user.id)

twitter_url = "https://twitter.com/intent/tweet?"
twitter_args = {
"text": _("Awesome VPN! 3€ per month, with a free 7 days trial!"),
"via": "CCrypto_VPN",
"url": ref_url,
"related": "CCrypto_VPN,CCrypto_org",
}

class price_fn:
"""Clever hack to get the price in templates with {{price.3}} with
3 an arbitrary number of months
@@ -203,7 +195,6 @@ def index(request):
context = dict(
title=_("Account"),
ref_url=ref_url,
twitter_link=twitter_url + urlencode(twitter_args),
subscription=request.user.vpnuser.get_subscription(),
backends=sorted(ACTIVE_BACKENDS.values(), key=lambda x: x.backend_display_name),
subscr_backends=sorted(
@@ -211,7 +202,6 @@ def index(request):
key=lambda x: x.backend_id,
),
default_backend="paypal",
hcaptcha_site_key=project_settings.HCAPTCHA_SITE_KEY,
price=price_fn(),
user_motd=site_config.MOTD_USER,
)


+ 51
- 47
locale/fr/LC_MESSAGES/django.po View File

@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: unnamed project\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-14 18:16+0000\n"
"PO-Revision-Date: 2021-09-14 20:17+0200\n"
"POT-Creation-Date: 2021-09-14 20:19+0000\n"
"PO-Revision-Date: 2021-09-14 22:21+0200\n"
"Last-Translator: alice <alice@ccrypto.org>\n"
"Language-Team: French <alice@ccrypto.org>\n"
"Language: fr\n"
@@ -99,11 +99,11 @@ msgstr "E-Mail"
msgid "Passwords are not the same"
msgstr "Les mots de passe de correspondent pas"

#: lambdainst/models.py:23
#: lambdainst/models.py:25
msgid "VPN User"
msgstr "VPN User"

#: lambdainst/models.py:24
#: lambdainst/models.py:26
msgid "VPN Users"
msgstr "VPN Users"

@@ -194,47 +194,43 @@ msgstr ""
msgid "Invalid captcha. Please try again"
msgstr "Captcha invalide. Veuillez ré-essayer"

#: lambdainst/views.py:187
msgid "Awesome VPN! 3€ per month, with a free 7 days trial!"
msgstr ""

#: lambdainst/views.py:204
#: lambdainst/views.py:196
msgid "Account"
msgstr "Compte"

#: lambdainst/views.py:388
#: lambdainst/views.py:379
msgid "Invalid password"
msgstr "Mot de passe invalide"

#: lambdainst/views.py:395
#: lambdainst/views.py:386
msgid "OK! Email address changed."
msgstr "OK! L'adresse a été changée."

#: lambdainst/views.py:398
#: lambdainst/views.py:389
msgid "OK! Email address unset."
msgstr "OK! L'adresse a été éffacée."

#: lambdainst/views.py:407
#: lambdainst/views.py:398
msgid "Password and confirmation do not match"
msgstr "Le mot de passe et la confirmation ne correspondent pas"

#: lambdainst/views.py:410
#: lambdainst/views.py:401
msgid "OK! Password changed."
msgstr "Votre mot de passe a bien été changé."

#: lambdainst/views.py:430
#: lambdainst/views.py:421
msgid "OK! Your account has been deactivated."
msgstr "Votre compte a bien été désactivé."

#: lambdainst/views.py:437 templates/account_layout.html:34
#: lambdainst/views.py:428 templates/account_layout.html:34
msgid "Settings"
msgstr "Options"

#: lambdainst/views.py:450
#: lambdainst/views.py:441
msgid "Config"
msgstr "Config"

#: lambdainst/views.py:482 templates/layout.html:43
#: lambdainst/views.py:473 templates/layout.html:43
msgid "Servers"
msgstr "Serveurs"

@@ -481,83 +477,93 @@ msgstr "ACTIF"
msgid "INACTIVE"
msgstr "INACTIF"

#: templates/lambdainst/account.html:34 templates/lambdainst/account.html:68
#: templates/lambdainst/account.html:34 templates/lambdainst/account.html:73
msgid "Subscription"
msgstr "Abonnement"

#: templates/lambdainst/account.html:37
#, python-format
msgid ""
"<b>FAILING</b> since %(since)s. (%(backend)s)<br /> Please cancel and "
"subscribe again if you need to switch to another payment method."
msgstr ""
"<b>ERREUR</b> depuis %(since)s. (%(backend)s)<br />\n"
"Veuillez annuler et vous réabonner pour changer de méthode ou carte de "
"paiement."

#: templates/lambdainst/account.html:42
#, python-format
msgid "<b>ACTIVE</b>. Renews on %(until)s via %(backend)s."
msgstr "<b>ACTIF</b>. Renouvellement: %(until)s via %(backend)s"

#: templates/lambdainst/account.html:40
#: templates/lambdainst/account.html:45
msgid "cancel"
msgstr "annuler"

#: templates/lambdainst/account.html:48
#: templates/lambdainst/account.html:53
msgid "Expiration"
msgstr "Expiration"

#: templates/lambdainst/account.html:52
#: templates/lambdainst/account.html:57
#, python-format
msgid "(%(left)s left)"
msgstr "(%(left)s restant)"

#: templates/lambdainst/account.html:76
#: templates/lambdainst/account.html:81
msgid "Pay every"
msgstr "Payer tous les"

#: templates/lambdainst/account.html:78 templates/lambdainst/account.html:79
#: templates/lambdainst/account.html:80 templates/lambdainst/account.html:117
#: templates/lambdainst/account.html:118 templates/lambdainst/account.html:119
#: templates/lambdainst/account.html:83 templates/lambdainst/account.html:84
#: templates/lambdainst/account.html:85 templates/lambdainst/account.html:122
#: templates/lambdainst/account.html:123 templates/lambdainst/account.html:124
msgid "months"
msgstr "mois"

#: templates/lambdainst/account.html:85 templates/lambdainst/account.html:124
#: templates/lambdainst/account.html:90 templates/lambdainst/account.html:129
msgid "by"
msgstr "par"

#: templates/lambdainst/account.html:97
#: templates/lambdainst/account.html:102
msgid "Subscribe"
msgstr "S'abonner"

#: templates/lambdainst/account.html:99
#: templates/lambdainst/account.html:104
msgid "You can cancel the recurring payment at any time."
msgstr "Vous pouvez annuler le paiement récurrent à n'importe quel moment."

#: templates/lambdainst/account.html:106
#: templates/lambdainst/account.html:111
msgid "One-time payment"
msgstr "Paiement ponctuel"

#: templates/lambdainst/account.html:114
#: templates/lambdainst/account.html:119
msgid "Add"
msgstr "Ajouter"

#: templates/lambdainst/account.html:116
#: templates/lambdainst/account.html:121
msgid "month"
msgstr "mois"

#: templates/lambdainst/account.html:136
#: templates/lambdainst/account.html:141
msgid "Buy Now"
msgstr "Payer"

#: templates/lambdainst/account.html:138
#: templates/lambdainst/account.html:143
msgid "If you still have time, the first payment will be delayed."
msgstr "S'il vous reste du temps, le premier paiement sera reporté."

#: templates/lambdainst/account.html:145
#: templates/lambdainst/account.html:150
msgid "Coupon"
msgstr "Coupon"

#: templates/lambdainst/account.html:152
#: templates/lambdainst/account.html:157
msgid "Code"
msgstr "Code"

#: templates/lambdainst/account.html:158
#: templates/lambdainst/account.html:163
msgid "Use"
msgstr "Utiliser"

#: templates/lambdainst/account.html:160
#: templates/lambdainst/account.html:165
msgid ""
"Our coupons are alphanumeric codes that give you a fixed duration of VPN "
"access."
@@ -565,11 +571,11 @@ msgstr ""
"Nos coupons sont des codes alphanumériques qui donnent une durée fixe "
"d'accès au VPN."

#: templates/lambdainst/account.html:161
#: templates/lambdainst/account.html:166
msgid "They can be single or multi use."
msgstr "À usage unique ou multiple."

#: templates/lambdainst/account.html:173
#: templates/lambdainst/account.html:178
msgid ""
"Please recommend us to your friends and on social media! We do not advertise "
"and rely on you to help us grow and improve our services."
@@ -577,7 +583,7 @@ msgstr ""
"Recommandez-nous à vos amis et sur les réseaux sociaux! Nous ne faisons pas "
"de publicité et comptons sur vous pour nous aider à améliorer nos services."

#: templates/lambdainst/account.html:178
#: templates/lambdainst/account.html:183
msgid ""
"Every subscription through this link will grant you 1&nbsp;month of VPN "
"access:"
@@ -665,7 +671,6 @@ msgid "Enable IPv6?"
msgstr "Activer l'IPv6?"

#: templates/lambdainst/config.html:59 templates/lambdainst/wireguard.html:129
#| msgid "Download {} v{}"
msgid "Download"
msgstr "Télécharger"

@@ -873,7 +878,6 @@ msgid "You can try an alternative server port if 51820 is blocked."
msgstr "Essayez un port alternatif si 51820 est bloqué pour vous."

#: templates/lambdainst/wireguard.html:132
#| msgid "Code"
msgid "QR Code"
msgstr "Code QR"

@@ -1062,8 +1066,8 @@ msgid ""
"We already cover many common questions and problems in our <a href=\"/kb/"
"\"><em>Knowledge Base</em></a>. Take a look if you have any question."
msgstr ""
"Nous couvrons de nombreuses questions et problèmes dans notre <a href="
"\"/kb/\"><em>F.A.Q.</em></a>"
"Nous couvrons de nombreuses questions et problèmes dans notre <a href=\"/kb/"
"\"><em>F.A.Q.</em></a>"

#: templates/pages/help.html:29
msgid ""
@@ -1071,8 +1075,8 @@ msgid ""
"\"/tickets/\"><em>Tickets</em></a> for technical or billing issues."
msgstr ""
"Si vous devez nous contacter, le moyen le plus rapide est <a href=\"/tickets/"
"\"><em>les tickets</em></a> pour les questions technique en rapport à "
"votre compte."
"\"><em>les tickets</em></a> pour les questions technique en rapport à votre "
"compte."

#: templates/pages/help.html:35
msgid ""


+ 8
- 3
templates/lambdainst/account.html View File

@@ -24,16 +24,21 @@
<td>{% trans "Status" %}</td>
<td class="account-status__status">
{% if user.vpnuser.is_paid %}
{% trans "ACTIVE" %}
{% trans "ACTIVE" %}
{% else %}
{% trans "INACTIVE" %}
{% trans "INACTIVE" %}
{% endif %}
</td>
</tr>
<tr>
<td>{% trans "Subscription" %}</td>
<td>
{% if subscription.status == 'active' %}
{% if subscription.status == 'active' and request.user.vpnuser.subscr_is_failing %}
{% blocktrans trimmed with since=subscription.next_renew|default:user.vpnuser.expiration|date:'Y-m-d' backend=subscription.backend.backend_verbose_name %}
<b>FAILING</b> since {{since}}. ({{backend}})<br />
Please cancel and subscribe again if you need to switch to another payment method.
{% endblocktrans %}
{% elif subscription.status == 'active' %}
{% blocktrans trimmed with until=subscription.next_renew|default:user.vpnuser.expiration|date:'Y-m-d' backend=subscription.backend.backend_verbose_name %}
<b>ACTIVE</b>. Renews on {{until}} via {{backend}}.
{% endblocktrans %}


Loading…
Cancel
Save