Coverage for baibu/users/sign_in_config.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-10-06 13:07 +0000

1"""Build django-allauth's sign-in settings from the environment. 

2 

3Kept free of Django imports so the settings module can call it. Phone 

4sign-in adds "phone" as a sign-in method and a phone field at sign-up; 

5email stays required either way. 

6""" 

7 

8 

9def login_methods(*, phone: bool) -> set[str]: 

10 return {"email", "phone"} if phone else {"email"} 

11 

12 

13def signup_fields(*, phone: bool, phone_required: bool) -> list[str]: 

14 fields = ["email*", "password1*", "password2*"] 

15 if phone: 

16 fields.insert(1, "phone*" if phone_required else "phone") 

17 return fields