django-mfa3

multi factor authentication for django
git clone https://git.ce9e.org/django-mfa3.git

commit
fb1a75baf468c433e820d52780a3b95a624d2267
parent
8194db4b25345b75002cd9e81ca27659b3f63294
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-12-08 10:07
tweak example message wording

inspired by https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98507

Diffstat

M mfa/templates/mfa/login_failed_subject.txt 2 +-
M tests/templates/mfa/login_failed_email.txt 10 +++++++---
M tests/tests.py 12 ++++++++----

3 files changed, 16 insertions, 8 deletions


diff --git a/mfa/templates/mfa/login_failed_subject.txt b/mfa/templates/mfa/login_failed_subject.txt

@@ -1,3 +1,3 @@
    1     1 {% load i18n %}{% autoescape off %}
    2    -1 {% blocktranslate %}Failed login on {{ site_name }}{% endblocktranslate %}
   -1     2 {% blocktranslate %}Attempted login to {{ site_name }} using a wrong two-factor authentication code{% endblocktranslate %}
    3     3 {% endautoescape %
    3     3 
\ No newline at end of file

diff --git a/tests/templates/mfa/login_failed_email.txt b/tests/templates/mfa/login_failed_email.txt

@@ -1,6 +1,10 @@
    1     1 Dear {{ user.username }},
    2     2 
    3    -1 someone tried to log in to your account at {{ site_name }} ({{ domain }}).
    4    -1 They managed to enter the correct password, but failed at {{ method }}.
   -1     3 We detected an attempt to log in to your account on {{ site_name }}
   -1     4 ({{ domain }}) using a wrong two-factor authentication code. This means someone
   -1     5 managed to enter the correct password, but failed at {{ method }}.
    5     6 
    6    -1 If this wasn't you we strongly recommend to change your password.
   -1     7 If this was you and you entered a wrong two-factor authentication code by
   -1     8 accident, you may ignore this email.
   -1     9 
   -1    10 If this was not you, we strongly recommend to change your password.

diff --git a/tests/tests.py b/tests/tests.py

@@ -309,11 +309,15 @@ class MailTest(TestCase):
  309   309 
  310   310         message = mail.outbox[0]
  311   311         self.assertEqual(message.to, ['test@example.com'])
  312    -1         self.assertEqual(message.subject, 'Failed login on Tests')
   -1   312         self.assertEqual(message.subject, 'Attempted login to Tests using a wrong two-factor authentication code')  # noqa
  313   313         self.assertEqual(message.body, """Dear test,
  314   314 
  315    -1 someone tried to log in to your account at Tests (localhost).
  316    -1 They managed to enter the correct password, but failed at FIDO2.
   -1   315 We detected an attempt to log in to your account on Tests
   -1   316 (localhost) using a wrong two-factor authentication code. This means someone
   -1   317 managed to enter the correct password, but failed at FIDO2.
  317   318 
  318    -1 If this wasn't you we strongly recommend to change your password.
   -1   319 If this was you and you entered a wrong two-factor authentication code by
   -1   320 accident, you may ignore this email.
   -1   321 
   -1   322 If this was not you, we strongly recommend to change your password.
  319   323 """)