Coverage for baibu/users/checks.py: 100%
9 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-10-06 13:07 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-10-06 13:07 +0000
1from django.conf import settings
2from django.core.checks import Tags
3from django.core.checks import Warning # noqa: A004
4from django.core.checks import register
7@register(Tags.security, deploy=True)
8def phone_sign_in_provider_check(app_configs, **kwargs):
9 """Warn when phone sign-in is on but codes would only be logged."""
10 if settings.PHONE_SIGN_IN_ENABLED and settings.MESSAGING_PROVIDER.endswith(".ConsoleMessagingProvider"):
11 return [
12 Warning(
13 "PHONE_SIGN_IN_ENABLED is on, but MESSAGING_PROVIDER is the console provider: "
14 "sign-in codes are written to the log, not sent.",
15 hint="Set MESSAGING_PROVIDER to your own provider class. See the phone sign-in docs.",
16 id="users.W001",
17 ),
18 ]
19 return []