#32030: Make Token Generator more universal
------------------------------+----------------------------------------
     Reporter:  Ilya Chichak  |                    Owner:  Ilya Chichak
         Type:  New feature   |                   Status:  closed
    Component:  contrib.auth  |                  Version:  3.1
     Severity:  Normal        |               Resolution:  duplicate
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  1             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+----------------------------------------
Changes (by Ilya Chichak):

 * 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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.af4861862ae316c96fd2747cae034d8a%40djangoproject.com.

Reply via email to