Commit 8658d0ce authored by David Seaward's avatar David Seaward

general cleanup

* tweak recovery email messages
* update Django version (security update)
* update copyright years
* remove unused config settings
* update model diagram (and instructions)
Signed-off-by: David Seaward's avatarDavid Seaward <david.seaward@puri.sm>
parent 59e1a03f
Pipeline #11649 passed with stage
in 37 seconds
......@@ -2,7 +2,7 @@
Keel (LDH middleware)
<https://source.puri.sm/liberty/ldh_middleware>
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
SPDX-License-Identifier: AGPL-3.0-or-later
This program is free software: you can redistribute it and/or modify
......
......@@ -20,7 +20,7 @@ python-decouple = "==3.1"
python-ldap = "==3.0.0"
strictyaml = "==0.11.10"
confusable_homoglyphs = "==3.0.0"
Django = "==1.11.18"
Django = "==1.11.20"
django_celery_beat = "==1.1.0"
Jinja2 = "==2.10"
WooCommerce = "==1.2.1"
......@@ -29,29 +29,10 @@ djangorestframework = "==3.9.2"
django-password-reset = "==2.0"
[dev-packages]
# self:
# purist_middleware = {path = ".", editable = true}
# Documentation depencencies:
# alabaster==0.7.10
# Babel==2.5.3
# certifi==2017.11.5
# chardet==3.0.4
# docutils==0.14
# idna==2.6
# imagesize==0.7.1
# Jinja2==2.10
# MarkupSafe==1.0
# Pygments==2.2.0
# pytz==2017.3
# requests==2.18.4
# six==1.11.0
# snowballstemmer==1.2.1
# Sphinx==1.6.6
# sphinxcontrib-websupport==1.0.1
# urllib3==1.22
twine = "==1.12.1"
pylint = "*"
django_extensions = "*"
pydotplus = "*"
[requires]
python_version = "3"
......@@ -35,9 +35,12 @@ Models
Model diagram generated with:
./manage.py graph_models --all-applications --group-models \
./ldh_middleware graph_models --all-applications --group-models \
--verbose-name --output models.png
Requires GraphViz (`apt install graphviz`) and dev dependencies
(`pipenv install --dev`).
Build wheel package (and optionally upload)
-------------------------------------------
......@@ -127,7 +130,7 @@ Sharing and contributions
Keel (LDH middleware)
<https://source.puri.sm/liberty/ldh_middleware>
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
SPDX-License-Identifier: AGPL-3.0-or-later
Shared under AGPL-3.0-or-later. We adhere to the Community Covenant
......
# Django
# 3rd party
from captcha.fields import CaptchaField
from django import forms
from django.conf import settings
......@@ -14,12 +12,10 @@ from django.utils.translation import ugettext_lazy as _
from registration.backends.simple.views import RegistrationView
from registration.forms import validators
# Others
from cart.models import ChosenReward
from ldapregister.forms import RegistrationForm
from purist.models import AccountType, get_woo_connection
User = get_user_model()
......@@ -34,7 +30,7 @@ def woo_email_available_validator(value):
wc = get_woo_connection()
result = wc.get('customers?email={}'.format(value))
if result.ok and len(result.json()) > 0:
raise ValidationError(_('This recovery email is already in use'))
raise ValidationError(_('This recovery email is already in use.'))
class CartRegistrationForm(RegistrationForm):
......@@ -50,12 +46,11 @@ class CartRegistrationForm(RegistrationForm):
email = forms.EmailField(
label=_('Recovery email address'),
help_text=_('Optional. Enter an email address were we can send you '
help_text=_('Enter an email address where we can send you '
'recovery information.'),
validators=[
validators.validate_confusables_email, woo_email_available_validator
],
required=False,
)
password1 = forms.CharField(
......
......@@ -13,7 +13,6 @@ DEBUG_CHANGE_PASSWORD=False
DEBUG_REGISTER_STATUS = True
DEBUG_SKIP_ACTIVATION_COMMAND=True
DEBUG_SKIP_VALIDATE_ON_AUTHENTICATION = False
DEBUG_LOCAL_MAIL = False
DEBUG_REMOVE_CAPTCHA = False
# change to false after initial setup
ALLOWED_HOSTS=localhost
......@@ -70,7 +69,7 @@ EMAIL_HOST_USER = jhon.doe@example.com
EMAIL_PORT = 465
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = "Do not replay <noreply@example.com>"
DEFAULT_FROM_EMAIL = "Do not reply <noreply@example.com>"
# This is the link to the subscribe page, used in different parts of the middleware
SUBSCRIBE_HREF = /#bundle
; stored as /etc/supervisor/conf.d/purist_middleware_monitor.conf
; Copyright 2017-2018 Purism SPC
; Copyright 2017-2019 Purism SPC
; SPDX-License-Identifier: AGPL-3.0-or-later
; Adapted from extra/supervisord/celerybeat.conf in Celery
......
......@@ -57,7 +57,7 @@ master_doc = 'index'
# General information about the project.
project = 'Keel (LDH middleware)'
copyright = '2017-2018 Purism SPC'
copyright = '2017-2019 Purism SPC'
author = 'Purism SPC'
# The version info for the project you're documenting, acts as replacement for
......
......@@ -2,7 +2,7 @@
{% load i18n %} {% load static %}
<!--
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
......@@ -2,7 +2,7 @@
<!--
Keel (LDH middleware)
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
# Copyright 2017-2018 Purism SPC
# Copyright 2017-2019 Purism SPC
# SPDX-License-Identifier: AGPL-3.0-or-later
# Original file from Celery 4.0.2 documentation
......
......@@ -36,7 +36,6 @@ DEBUG_CHANGE_PASSWORD = config("DEBUG_CHANGE_PASSWORD", cast=bool)
DEBUG_SKIP_ACTIVATION_COMMAND = config("DEBUG_SKIP_ACTIVATION_COMMAND", cast=bool)
DEBUG_SKIP_VALIDATE_ON_AUTHENTICATION = config("DEBUG_SKIP_VALIDATE_ON_AUTHENTICATION", cast=bool)
DEBUG_REGISTER_STATUS = config("DEBUG_REGISTER_STATUS", cast=bool)
DEBUG_LOCAL_MAIL = config("DEBUG_LOCAL_MAIL", cast=bool)
DEBUG_REMOVE_CAPTCHA = config("DEBUG_REMOVE_CAPTCHA", cast=bool)
......@@ -161,7 +160,7 @@ SITE_BYLINE = config("SITE_BYLINE")
SITE_DOMAIN = config("SITE_DOMAIN")
SITE_PROVIDER = config("SITE_PROVIDER")
SITE_PROVIDER_LINK = config("SITE_PROVIDER_LINK")
EMAIL_DOMAIN = config("EMAIL_DOMAIN")
#
# WOOCOMMERCE
#
......@@ -288,4 +287,3 @@ EMAIL_USE_SSL = config('EMAIL_USE_SSL', False, cast=bool)
# This is the link to the subscribe page, used in different parts of the middleware
SUBSCRIBE_HREF = config('SUBSCRIBE_HREF')
models.png

279 KB | W: | H:

models.png

356 KB | W: | H:

models.png
models.png
models.png
models.png
  • 2-up
  • Swipe
  • Onion skin
<!DOCTYPE html>
<!--
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
<!DOCTYPE html>
<!--
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
import logging
from choicesenum import ChoicesEnum
from choicesenum.django.fields import EnumIntegerField
from cryptography.fernet import Fernet
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager as BaseUserManager
from django.contrib.auth.hashers import make_password
from django.core import validators
from django.db import models
from django.utils import timezone
from django.utils.crypto import salted_hmac
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
from woocommerce import API as WOO_API
from ldapregister.models import LdapPerson, LdapGroup
from limitmonitor import models as limitmonitor_models
from limitmonitor.task_resources import common as limitmonitor_common
from limitmonitor.tunnel import TunnelManager
from cryptography.fernet import Fernet
from choicesenum import ChoicesEnum
from choicesenum.django.fields import EnumIntegerField
from woocommerce import API as WOO_API
log = logging.getLogger(__name__)
......@@ -75,13 +75,13 @@ class User(AbstractUser):
_('username'),
max_length=150,
unique=True,
help_text=_('Required. Start with a letter, followed by letters or numbers.'),
help_text=_('Start with a letter, followed by letters or numbers.'),
validators=[username_validator],
error_messages={
'unique': _("An account with that address already exists."),
},
)
email = models.EmailField(_('email address'), blank=False, unique=True)
email = models.EmailField(_('email address'), blank=False, unique=True) # recovery email address
tunnel_user = models.CharField(max_length=250, default=None, null=True)
tunnel_password = models.CharField(max_length=250, default=None, null=True)
account_type = EnumIntegerField(enum=AccountType,
......@@ -419,7 +419,8 @@ class User(AbstractUser):
@property
def contact_email(self):
if self.account_type is AccountType.COMPLETE:
return self.username + '@' + settings.EMAIL_DOMAIN
return self.get_identity()
else:
return self.email
def get_enabled_limits(self):
......
......@@ -3,7 +3,7 @@
{% load i18n %}
<!--
Keel (LDH middleware)
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
......@@ -3,7 +3,7 @@
{% load i18n %}
<!--
Keel (LDH middleware)
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
......@@ -3,7 +3,7 @@
{% load i18n %}
<!--
Keel (LDH middleware)
Copyright 2017-2018 Purism SPC
Copyright 2017-2019 Purism SPC
https://source.puri.sm/liberty/ldh_middleware
SPDX-License-Identifier: AGPL-3.0
-->
......
# do not modify manually
# generated with "pipenv run pip freeze > requirements.txt"
amqp==2.3.2
amqp==2.4.2
asn1crypto==0.24.0
bcrypt==3.1.4
billiard==3.5.0.4
astroid==2.2.4
bcrypt==3.1.6
billiard==3.5.0.5
bleach==3.1.0
celery==4.1.1
certifi==2018.8.13
cffi==1.11.5
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
choicesenum==0.2.2
confusable-homoglyphs==3.0.0
cryptography==2.3.1
cryptography==2.6.1
dj-database-url==0.4.2
Django==1.11.17
Django==1.11.20
django-agpl==4.0.0
django-auth-ldap==1.3.0
django-celery-beat==1.1.0
django-crispy-forms==1.7.0
django-extensions==1.9.9
django-ldapdb==0.9.0
django-ldapdb==1.0.0
django-password-reset==2.0
django-ranged-response==0.2.0
django-registration==2.4.1
django-simple-captcha==0.5.10
djangorestframework==3.9.2
docutils==0.14
ephem==3.7.6.0
idna==2.7
idna==2.8
isort==4.3.13
Jinja2==2.10
jinja2-django-tags==0.5
kombu==4.2.1
MarkupSafe==1.0
kombu==4.5.0
lazy-object-proxy==1.3.1
MarkupSafe==1.1.1
mccabe==0.6.1
ordereddict==1.1
paramiko==2.4.1
Pillow==6.0.0
pkg-resources==0.0.0
pkginfo==1.5.0.1
pyasn1==0.4.2
pyasn1-modules==0.2.2
pycparser==2.18
pyasn1-modules==0.2.5
pycparser==2.19
pydotplus==2.0.2
Pygments==2.3.1
pyldap==3.0.0.post1
PyNaCl==1.2.1
python-dateutil==2.7.3
pylint==2.3.1
PyNaCl==1.3.0
pyparsing==2.4.0
python-dateutil==2.8.0
python-decouple==3.1
python-ldap==3.0.0
pytz==2018.5
requests==2.19.1
ruamel.yaml==0.15.55
six==1.11.0
pytz==2019.1
readme-renderer==24.0
requests==2.21.0
requests-toolbelt==0.9.1
ruamel.yaml==0.15.95
six==1.12.0
strictyaml==0.11.10
typing==3.6.4
urllib3==1.23
vine==1.1.4
tqdm==4.31.1
twine==1.12.1
typed-ast==1.3.1
typing==3.6.6
urllib3==1.24.3
vine==1.3.0
webencodings==0.5.1
WooCommerce==1.2.1
djangorestframework==3.9.2
django-password-reset==2.0
wrapt==1.11.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment