You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #62 from RandomProgramm3r/develop
refactor(user, validators): extract PromoActivationService & simplify password validators
This commit consolidates and improves core user-related logic by:
- Extracting promo code activation functionality from `PromoActivateView` into a new `PromoActivationService` in `user/services.py`, which now handles:
- User targeting (age, country) checks
- Promo active status verification
- Anti‑fraud validation
- Atomic issuance for common and unique promo codes
- Granular exceptions (`PromoActivationError`, `TargetingError`, etc.) for clearer API error responses
- Simplifying password validation by:
- Removing the `BaseCountPasswordValidator` abstract class in favor of standalone validators
- Renaming classes for brevity (e.g. `AsciiValidator`, `UppercaseValidator`)
- Leveraging built‑in methods like `isascii()` and `isupper()` for clarity and performance
- Using `ngettext` to enhance internationalized, pluralized error messages
- Updating `settings.py` to reference new validator names and options
Both the view and validator integrations have been streamlined for maintainability and adherence to Django conventions.
0 commit comments