chore: finalize no email verification policy

This commit is contained in:
QiuSW
2026-07-06 14:02:48 +08:00
parent eedc35cc4b
commit c89cb4cf28
12 changed files with 70 additions and 39 deletions
+12 -6
View File
@@ -124,7 +124,7 @@ class PortalAccountFlowTests(TestCase):
html,
)
def test_signup_creates_unverified_user_wallet_with_zero_points_and_no_ledger(self):
def test_signup_creates_user_wallet_with_zero_points_no_ledger_and_can_login(self):
suffix = uuid.uuid4().hex[:8]
email = f"signup-{suffix}@example.com"
@@ -146,9 +146,10 @@ class PortalAccountFlowTests(TestCase):
self.assertTrue(email_address.primary)
self.assertEqual(wallet.points_balance, 0)
self.assertFalse(PointsLedger.objects.filter(user=user).exists())
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(len(mail.outbox), 0)
self.assertTrue(get_user(self.client).is_authenticated)
def test_unverified_email_cannot_establish_login_session(self):
def test_user_can_login_without_verified_email(self):
suffix = uuid.uuid4().hex[:8]
user = get_user_model().objects.create_user(
username=f"unverified-{suffix}",
@@ -162,11 +163,16 @@ class PortalAccountFlowTests(TestCase):
primary=True,
)
self.client.post("/login", {"login": user.email, "password": self.password})
login_response = self.client.post(
"/login",
{"login": user.email, "password": self.password},
)
self.assertFalse(get_user(self.client).is_authenticated)
self.assertEqual(login_response.status_code, 302)
self.assertEqual(login_response["Location"], "/dashboard")
self.assertTrue(get_user(self.client).is_authenticated)
def test_verified_user_can_login_view_dashboard_and_logout(self):
def test_user_can_login_view_dashboard_and_logout(self):
user = self.create_verified_user()
UserWallet.objects.create(user=user, points_balance=42)