Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32030 closed New feature (duplicate)

Make Token Generator more universal

Reported by: Ilya Chichak Owned by: Ilya Chichak
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 (last modified by Ilya Chichak)

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.

https://github.com/django/django/pull/13444

Change History (6)

comment:1 by Ilya Chichak, 4 years ago

Owner: changed from nobody to Ilya Chichak
Status: newassigned

comment:2 by Mariusz Felisiak, 4 years ago

Duplicate of #30423.

comment:3 by Mariusz Felisiak, 4 years ago

Resolution: duplicate
Status: assignedclosed

comment:4 by Ilya Chichak, 4 years ago

@felixxm

In ticket you provided you said PasswordResetTokenGenerator is not universal.
So, I made BaseTokenGenerator that is more universal and flexible and not breaking current code.

Can I hear alternative opinion?

comment:5 by Ilya Chichak, 4 years ago

Description: modified (diff)
Has patch: set

comment:6 by Mariusz Felisiak, 4 years ago

Ilya, please continue a discussion in the original ticket and follow triaging guidelines with regards to wontfix tickets. You can start a discussion on DevelopersMailingList if you don't agree.

Note: See TracTickets for help on using tickets.
Back to Top