config.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from datetime import timedelta
  2. #: The default name of the "remember me" cookie (``remember_token``)
  3. COOKIE_NAME = "remember_token"
  4. #: The default time before the "remember me" cookie expires (365 days).
  5. COOKIE_DURATION = timedelta(days=365)
  6. #: Whether the "remember me" cookie requires Secure; defaults to ``False``
  7. COOKIE_SECURE = False
  8. #: Whether the "remember me" cookie uses HttpOnly or not; defaults to ``True``
  9. COOKIE_HTTPONLY = True
  10. #: Whether the "remember me" cookie requires same origin; defaults to ``None``
  11. COOKIE_SAMESITE = None
  12. #: The default flash message to display when users need to log in.
  13. LOGIN_MESSAGE = "Please log in to access this page."
  14. #: The default flash message category to display when users need to log in.
  15. LOGIN_MESSAGE_CATEGORY = "message"
  16. #: The default flash message to display when users need to reauthenticate.
  17. REFRESH_MESSAGE = "Please reauthenticate to access this page."
  18. #: The default flash message category to display when users need to
  19. #: reauthenticate.
  20. REFRESH_MESSAGE_CATEGORY = "message"
  21. #: The default attribute to retreive the str id of the user
  22. ID_ATTRIBUTE = "get_id"
  23. #: Default name of the auth header (``Authorization``)
  24. AUTH_HEADER_NAME = "Authorization"
  25. #: A set of session keys that are populated by Flask-Login. Use this set to
  26. #: purge keys safely and accurately.
  27. SESSION_KEYS = {
  28. "_user_id",
  29. "_remember",
  30. "_remember_seconds",
  31. "_id",
  32. "_fresh",
  33. "next",
  34. }
  35. #: A set of HTTP methods which are exempt from `login_required` and
  36. #: `fresh_login_required`. By default, this is just ``OPTIONS``.
  37. EXEMPT_METHODS = {"OPTIONS"}
  38. #: If true, the page the user is attempting to access is stored in the session
  39. #: rather than a url parameter when redirecting to the login view; defaults to
  40. #: ``False``.
  41. USE_SESSION_FOR_NEXT = False