Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting SECRET_KEY to be str or bytes, add SECRET_KEY_FALLBACKS, update PasswordResetTokenGenerator #1411

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion django-stubs/conf/global_settings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ IGNORABLE_404_URLS: list[Pattern[str]]
# A secret key for this particular Django installation. Used in secret-key
# hashing algorithms. Set this in your settings, or Django will complain
# loudly.
SECRET_KEY: str
SECRET_KEY: str | bytes

# A list of fallback secret keys for a particular Django installation. These
# are used to allow rotation of the SECRET_KEY.
SECRET_KEY_FALLBACKS: list[str | bytes]

# Default file storage mechanism that holds media.
DEFAULT_FILE_STORAGE: str
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/auth/tokens.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ from django.contrib.auth.base_user import AbstractBaseUser

class PasswordResetTokenGenerator:
key_salt: str
secret: Any
secret: str | bytes
secret_fallbacks: list[str | bytes]
algorithm: str
def make_token(self, user: AbstractBaseUser) -> str: ...
def check_token(self, user: AbstractBaseUser | None, token: str | None) -> bool: ...
Expand Down