您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

37 行
1.3 KiB

  1. """passlib.ext.django.models -- monkeypatch django hashing framework"""
  2. #=============================================================================
  3. # imports
  4. #=============================================================================
  5. # core
  6. # site
  7. # pkg
  8. from passlib.context import CryptContext
  9. from passlib.ext.django.utils import DjangoContextAdapter
  10. # local
  11. __all__ = ["password_context"]
  12. #=============================================================================
  13. # global attrs
  14. #=============================================================================
  15. #: adapter instance used to drive most of this
  16. adapter = DjangoContextAdapter()
  17. # the context object which this patches contrib.auth to use for password hashing.
  18. # configuration controlled by ``settings.PASSLIB_CONFIG``.
  19. password_context = adapter.context
  20. #: hook callers should use if context is changed
  21. context_changed = adapter.reset_hashers
  22. #=============================================================================
  23. # main code
  24. #=============================================================================
  25. # load config & install monkeypatch
  26. adapter.load_model()
  27. #=============================================================================
  28. # eof
  29. #=============================================================================