config.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # -*- coding: utf-8 -*-
  2. '''
  3. flask_login.config
  4. ------------------
  5. This module provides default configuration values.
  6. '''
  7. from datetime import timedelta
  8. #: The default name of the "remember me" cookie (``remember_token``)
  9. COOKIE_NAME = 'remember_token'
  10. #: The default time before the "remember me" cookie expires (365 days).
  11. COOKIE_DURATION = timedelta(days=365)
  12. #: Whether the "remember me" cookie requires Secure; defaults to ``None``
  13. COOKIE_SECURE = None
  14. #: Whether the "remember me" cookie uses HttpOnly or not; defaults to ``False``
  15. COOKIE_HTTPONLY = False
  16. #: The default flash message to display when users need to log in.
  17. LOGIN_MESSAGE = u'Please log in to access this page.'
  18. #: The default flash message category to display when users need to log in.
  19. LOGIN_MESSAGE_CATEGORY = 'message'
  20. #: The default flash message to display when users need to reauthenticate.
  21. REFRESH_MESSAGE = u'Please reauthenticate to access this page.'
  22. #: The default flash message category to display when users need to
  23. #: reauthenticate.
  24. REFRESH_MESSAGE_CATEGORY = 'message'
  25. #: The default attribute to retreive the unicode id of the user
  26. ID_ATTRIBUTE = 'get_id'
  27. #: Default name of the auth header (``Authorization``)
  28. AUTH_HEADER_NAME = 'Authorization'
  29. #: A set of session keys that are populated by Flask-Login. Use this set to
  30. #: purge keys safely and accurately.
  31. SESSION_KEYS = set(['user_id', 'remember', '_id', '_fresh'])
  32. #: A set of HTTP methods which are exempt from `login_required` and
  33. #: `fresh_login_required`. By default, this is just ``OPTIONS``.
  34. EXEMPT_METHODS = set(['OPTIONS'])