Opened 5 years ago
Last modified 5 years ago
#32030 closed New feature
Make Token Generator more universal — at Initial Version
| Reported by: | Ilya Chichak | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | 3.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I suggest to split current PasswordResetTokenGenerator into BaseTokenGenerator and it's implementation PasswordResetTokenGenerator
To make BaseTokenGenerator more universal, it should contain class variable TOKEN_TIMEOUT with token timeout and _make_hash_value method public and abstract.
It will make possible to make email confirmation tokens, one time enter tokens and other with reimplementing make_hash_value method and setting separate timeout for each token generator. Current PasswordResetTokenGenerator will be implementation of BaseTokenGenerator where TOKEN_TIMEOUT will be settings.PASSWORD_RESET_TIMEOUT. So, for all logic, that uses PasswordResetTokenGenerator nothing will be changed.