#27467: UserAttributeSimilarityValidator max_similarity=0/1 doesn't work as
documented
-------------------------------------+-------------------------------------
     Reporter:  goblinJoel           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.auth         |                  Version:  1.9
     Severity:  Normal               |               Resolution:
     Keywords:  password management  |             Triage Stage:  Accepted
  validation validator               |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by goblinJoel):

 Replying to [comment:2 Erik Romijn]:
 > Fixing the code seems like the right approach to me too. This was an
 oversight when I originally wrote the code.
 Makes sense to me. In fact, now that I think about it, that would make a
 max_similarity of 0 behave as described, as well. As-is, using '''>''',
 assuming a computed similarity of 0 is possible, a password with no
 similarity must get accepted, because 0 is not greater than 0. Using
 '''>=''', it would be rejected, because 0 is greater than or equal to 0. I
 think the [https://github.com/django/django/pull/7534 PR] noticed the same
 thing.

 However, the documentation may need to be updated that way, too:

   The maximum similarity the password can have, '''before it is
 rejected''', can be set with the '''max_similarity''' parameter, on a
 scale of 0 to 1. A setting of 0 will cause all passwords to be rejected,
 whereas a setting of 1 will cause it to only reject passwords that are
 identical to an attribute’s value.

 If the code switches to '''>=''', max_similarity no longer represents the
 maximum similarity ''before'' rejection. It will instead be the minimum
 similarity ''for'' rejection. I assume this isn't worth renaming the
 parameter over, and maybe the 0 and 1 examples make it clear, but it
 seemed worth noting.

 PS: Wow! Did not expect to get a response this quickly!

--
Ticket URL: <https://code.djangoproject.com/ticket/27467#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.e733da98c35d3541de1b5e0bc072a0b9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to