Commit Graph
364 Commits
Author SHA1 Message Date
Antoine Nguyen f7c59390c6 Fixed issue introduced by lxml 4.7+
Looks like the html.tostring() function does not respect the encoding
setting anymore, the ascii value in particular...
2022-01-13 10:45:00 +01:00
Antoine Nguyen 45a7b4e74f Added message log view in new frontend. 2021-07-01 09:02:17 +02:00
Antoine Nguyen aed0614660 Better handling of API communication errors.
fix #2087
2021-06-30 14:20:37 +02:00
Antoine Nguyen a07d7b906b Merge branch 'master' into refacto/vuejs_interface 2021-05-30 09:53:50 +02:00
Antoine Nguyen bad2a96a61 Removed django-braces requirement. 2021-04-07 09:54:38 +02:00
Antoine Nguyen b81d2657f9 Merge branch 'master' into refacto/vuejs_interface 2021-02-12 21:35:47 +01:00
Antoine NguyenandGitHub 2a5e983fab Merge pull request #2159 from jeromelebleu/fix/api-revision
Wrap ModelViewSet requests to a revision block
2021-02-12 11:32:12 +01:00
Antoine Nguyen 1827bce52d Run doveadm command as vmail user.
see #2084
2021-02-11 17:16:21 +01:00
Jérôme Lebleu 233a8fe9fd Wrap ModelViewSet requests to a revision block 2021-02-11 15:17:30 +01:00
Antoine Nguyen b9f233c126 Introduced API versioning. 2020-10-30 18:49:30 +01:00
Antoine Nguyen 8898eda7c4 Merge branch 'master' into refacto/vuejs_interface 2020-10-07 10:14:27 +02:00
Antoine Nguyen f50c1fa679 Convert bytes output to str.
see #1990
2020-08-24 15:23:11 +02:00
Antoine Nguyen cb0197c609 Retrieve password by SMS.
see #1877
2020-04-21 11:34:29 +02:00
Antoine Nguyen 5b9b494593 ldap auth: fixed unit test. 2020-03-30 12:33:08 +02:00
Antoine Nguyen 56a9c44b93 ldap auth: avoid creation of duplicated identities. 2020-03-30 11:41:39 +02:00
Antoine Nguyen 87914d05c5 Updated coded function prototypes.
see #1689
2020-03-09 15:51:15 +01:00
Antoine Nguyen 59dfecd801 Use a classmethod here. 2020-02-17 17:52:10 +01:00
Antoine Nguyen cfa3c0bee5 Fixed loop. 2020-02-17 17:42:54 +01:00
Antoine Nguyen 4f5f8ba3fa Added support for a secondary LDAP server.
see #1842
2020-02-17 17:27:25 +01:00
Antoine Nguyen 5d9ac817b2 Allow login with username instead of email for LDAP.
see #1798
2020-02-17 15:52:32 +01:00
Jérôme Lebleu 09434afd9e Remove usage of six 2020-01-07 10:16:54 +01:00
Jérôme Lebleu 369d05e1c3 Remove the UTF-8 coding header 2020-01-07 10:16:54 +01:00
Jérôme Lebleu 74d66c00a0 Update imports for Python 3.4+ 2020-01-07 10:16:54 +01:00
Antoine Nguyen 250300f7ef Added support for unit when defining a quota.
see #1514
2018-10-17 13:42:51 +02:00
Anthony Bourguignon 2c4d707305 Improve code quality (again) 2018-10-14 12:50:32 +02:00
Anthony Bourguignon bb05f502cf Fix an issue with __metaclass__ in python3
improve code quality
2018-10-14 12:41:59 +02:00
Anthony Bourguignon 1836cee5fb Improve code quality
move doveadm call to sysutils
password hashers name and label are now class properties
2018-10-14 10:33:58 +02:00
Antoine Nguyen 69a5a2c243 Do not try to decode empty string. 2018-10-12 22:30:22 +02:00
Antoine Nguyen b9ff6ce6a6 fixed: enhanced decoding for SMTPUTF8 support.
see #1585
2018-10-12 16:44:25 +02:00
Antoine Nguyen 865c9226c1 Added settings to serializer. 2018-10-05 14:06:59 +02:00
Antoine Nguyen a6ae02112f Fixed issues with email decoding.
see #1535
2018-08-21 08:46:49 +02:00
Antoine Nguyen 0f98d9548c Fix attempt for #1510. 2018-07-10 11:18:22 +02:00
Antoine Nguyen 764615c612 Allow links to be rewrited. 2018-04-27 14:45:22 +02:00
Andrew Fyfe 846ad25323 when using LDAP use str (bytes) on PY2 and str on PY3 2018-03-26 18:31:42 +01:00
Andrew Fyfe f71414ddfa add missing utf8 header
use `# -*- coding: utf-8 -*-` which is more widely supported by editors
2018-02-03 00:59:08 +00:00
Andrew Fyfe 3159eca296 import unicode_literals
and remove it from empty __init__.py files
2018-02-03 00:59:07 +00:00
Andrew Fyfe 87e8a32063 whitespace fixes 2018-02-03 00:59:06 +00:00
Andrew Fyfe eaec271e02 pep8 fixes
- B007 Loop control variable not used within the loop body. If this is intended, start the name with an underscore.
    * modoboa/admin/lib.py
    * modoboa/admin/templatetags/admin_tags.py
    * modoboa/admin/tests/test_account.py
    * modoboa/admin/views/domain.py
    * modoboa/admin/views/identity.py
    * modoboa/core/views/dashboard.py
    * modoboa/limits/forms.py
    * modoboa/limits/handlers.py
    * modoboa/limits/tests/test_api.py
    * modoboa/limits/tests/test_domain_limits.py
    * modoboa/limits/tests/test_import.py
    * modoboa/limits/tests/test_user_limits.py
    * modoboa/limits/utils.py
    * modoboa/parameters/tools.py
    * modoboa/relaydomains/tests.py
- C402 Unnecessary generator - rewrite as a dict comprehension.
    * modoboa/admin/models/domain.py
    * modoboa/admin/views/domain.py
    * modoboa/admin/views/identity.py
    * modoboa/limits/searializers.py
- C407 Unnecessary list comprehension - can take a generator.
    * modoboa/core/password_validation.py
    * modoboa/parameters/tools.py
    * modoboa/transport/backends.py
- C408 Unnecessary dict call - rewrite as a literal.
    * modoboa/admin/tests/test_account.py
    * modoboa/admin/tests/test_alias.py
    * modoboa/admin/tests/test_password_schemes.py
    * modoboa/admin/views/domain.py
    * modoboa/admin/views/identity.py
    * modoboa/core/extensions.py
    * modoboa/lib/middleware.py
    * modoboa/lib/templatetags/form_tags.py
    * modoboa/lib/templatetags/lib_tags.py
    * modoboa/lib/web_utils.py
    * modoboa/limits/handlers.py
    * modoboa/limits/tests/test_user_limits.py
- E741 ambiguous variable name
    * modoboa/core/management/commands/cleanlogs.py
    * modoboa/limits/forms.py
    * modoboa/limits/tests/test_user_limits.py
    * modoboa/limits/utils.py
    * modoboa/relaydomains/tests.py
- F401 imported but unused
    * doc/conf.py
    * modoboa/admin/views/domain.py
    * modoboa/core/app_settings.py
    * modoboa/core/management/commands/load_initial_data.py
- F821 undefined name 'raw_input'
    * modoboa/core/commands/deploy.py
- F841 local variable 'test' is assigned to but never used
    * modoboa/core/app_settings.py
- N802 function name 'setUpTestData' should be lowercase xxx
    * modoboa/lib/email_utils.py - __ for name mangeling, _ for internal
- N805 first argument of a method should be named 'self'
    * modoboa/lib/connections.py
    * modoboa/lib/singleton.py

Ignore the following
- A001 "copyright" is a python builtin and is being shadowed, consider renaming the variable
    * doc/conf.py
- A003 is a python builtin, consider renaming the class attribute
    * modoboa/admin/factories.py
    * modoboa/admin/forms/domain.py
    * modoboa/admin/management/commands/handle_mailbox_operations.py
    * modoboa/admin/management/commands/modo.py
    * modoboa/admin/management/commands/subcommands/_repair.py
    * modoboa/admin/models/domain.py
    * modoboa/admin/models/mailbox.py
    * modoboa/core/commands/__init__.py
    * modoboa/core/commands/deploy.py
    * modoboa/core/commands/help.py
    * modoboa/core/management/commands/clean_inactive_accounts.py
    * modoboa/core/management/commands/cleanlogs.py
    * modoboa/core/management/commands/communicate_with_public_api.py
    * modoboa/core/management/commands/generate_postfix_maps.py
    * modoboa/core/management/commands/load_initial_data.py
    * modoboa/core/management/commands/set_default_site.py
- F401 imported but unused
    * modoboa/admin/apps.py - used to load handlers
    * modoboa/core/password_hashers/__init__.py - dynamically loaded
    * modoboa/limits/apps.py - used to load handlers
    * modoboa/relaydomains/apps.py - used to load handlers
    * modoboa/transport/apps.py - used to load handlers
- N802 function name should be lowercase xxx
    * modoboa/admin/tests/test_account.py
    * modoboa/admin/tests/test_alias.py
    * modoboa/admin/tests/test_domain_alias.py
    * modoboa/admin/tests/test_export.py
    * modoboa/admin/tests/test_mailbox_operations.py
    * modoboa/admin/tests/test_password_schemas.py
    * modoboa/admin/tests/test_repair.py
    * modoboa/core/tests/test_authentication.py
    * modoboa/core/tests/test_core.py
    * modoboa/core/tests/test_ldap.py
    * modoboa/core/tests/test_views.py
    * modoboa/lib/imap_utf7.py
    * modoboa/limits/tests/test_api.py
    * modoboa/limits/tests/test_domain_limits.py
    * modoboa/limits/tests/test_import.py
    * modoboa/limits/tests/test_user_limits.py
    * modoboa/relaydomains/tests.py

other fixes:
- use isinstance() instead of type() == Class
2018-02-03 00:44:00 +00:00
Andrew Fyfe 24a7ca6a9e sort imports using isort
pip install isort
isort -y
2018-02-03 00:43:59 +00:00
Andrew Fyfe 8a1d5736c9 fix quotes
This ensures all files use " for quotes with the exception of
migrations, as this are auto generated I've not modified them.

pip install unify
unify --in-place --recursive --quote \" .
2018-02-03 00:43:58 +00:00
Antoine Nguyen dad0827b7d Use default language code for new accounts.
see #1369
2018-02-02 14:18:02 +01:00
Andrew Fyfe d07e9c58ad better error handling for when e-mail messages lie about their encoding
also  fix test output, looks like it was getting truncated
2018-02-01 21:41:10 +00:00
Andrew Fyfe f94a1644ed add test for passing a string to prepare_addresses()
prepare_addresses() should convert this to a list.
2018-01-25 19:20:25 +00:00
Andrew Fyfe 441ba2affd getaddresses() expects a list 2018-01-25 17:40:31 +00:00
Andrew Fyfe 18a089dc66 split domain on the last @ 2018-01-22 20:14:22 +00:00
Andrew Fyfe 31b9f7afd0 parse lists of e-mail recipients properly
closes #1310
2018-01-19 20:15:13 +00:00
Andrew Fyfe 7e5a9b9ebb improve e-mail address splitting functions
Needed for modoboa/modoboa-amavis#89
2018-01-19 20:15:13 +00:00
Andrew Fyfe e8ab4e2912 refactor cryptutils
Cryptography can be a black art, rather than rolling our own crypto
functions use the ones provided by the Python Cryptography module.

- `encrypt()` and `decrypt()`
    - ECB is insecure and the Python Cryptography module recommends[1]
    against using it.  The Python Cryptography module offers Fernet[2]
    for encrypting values using a secret_key.

    - Djangos `settings.SECRET_KEY` exists for things like encrypting
      passwords, use it instead of Modoboas own `secret_key`.

    - `settings.SECRET_KEY` is truncated to 32 characters as Fernet
      requires a key 32 characters long.

- `random_key()` uses Dangos get_random_string() method, the same
code used to generate settings.SECRET_KEY

- add tests for cryptutil methods

[1] https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/?highlight=ecb#insecure-modes
[2] https://cryptography.io/en/latest/fernet/
2018-01-17 22:49:17 +00:00
Andrew Fyfe 26d24b7ff0 remove unrequired assert
Testing code that shouldn't have been included with modoboa/modoboa#1330
2018-01-08 19:42:24 +00:00
Andrew Fyfe ea0cf90d48 add tests for modoboa.lib.email_utils.Email 2018-01-03 17:16:05 +00:00