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.
--
Ticket URL: <https://code.djangoproject.com/ticket/32030>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Ilya Chichak
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/32030#comment:1>
* status: assigned => closed
* resolution: => duplicate
--
Ticket URL: <https://code.djangoproject.com/ticket/32030#comment:3>
Comment (by Ilya Chichak):
@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?
--
Ticket URL: <https://code.djangoproject.com/ticket/32030#comment:4>
* has_patch: 0 => 1
Old 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.
New 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.
https://github.com/django/django/pull/13444
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32030#comment:5>