-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faire en sorte que les comptes inactifs ne reçoivent pas de mail de c…
…onnexion #558
- Loading branch information
Showing
5 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.core import mail | ||
from django.test import TestCase, tag | ||
from django.test.client import Client | ||
|
||
from aidants_connect_web.tests.factories import AidantFactory | ||
|
||
|
||
@tag("usagers") | ||
class LoginTests(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.client = Client() | ||
cls.aidant = AidantFactory(is_active=False, post__with_otp_device=True) | ||
|
||
def test_inactive_aidant_with_valid_totp_cannot_login(self): | ||
response = self.client.post( | ||
"/accounts/login/", {"email": self.aidant.email, "otp_token": "123456"} | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
# Check explicit message is displayed | ||
self.assertContains( | ||
response, "Votre compte existe mais il n’est pas encore actif." | ||
) | ||
# Check no email was sent | ||
self.assertEqual(len(mail.outbox), 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from magicauth import views as magicauth_views | ||
|
||
from aidants_connect_web.forms import LoginEmailForm | ||
|
||
|
||
class LoginView(magicauth_views.LoginView): | ||
form_class = LoginEmailForm |