Loading django/contrib/auth/forms.py +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ from django.template import loader from django.utils.encoding import smart_str from django.utils.http import int_to_base36 from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _ from django.contrib.auth import authenticate from django.contrib.auth.models import User Loading Loading @@ -36,7 +36,7 @@ class ReadOnlyPasswordHashWidget(forms.Widget): summary = "" for key, value in hasher.safe_summary(encoded).iteritems(): summary += "<strong>%(key)s</strong>: %(value)s " % {"key": key, "value": value} summary += "<strong>%(key)s</strong>: %(value)s " % {"key": ugettext(key), "value": value} return mark_safe("<div%(attrs)s>%(summary)s</div>" % {"attrs": flatatt(final_attrs), "summary": summary}) Loading django/contrib/auth/hashers.py +17 −16 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.utils.encoding import smart_str from django.core.exceptions import ImproperlyConfigured from django.utils.crypto import ( pbkdf2, constant_time_compare, get_random_string) from django.utils.translation import ugettext_noop as _ UNUSABLE_PASSWORD = '!' # This will never be a valid encoded hash Loading Loading @@ -212,10 +213,10 @@ class PBKDF2PasswordHasher(BasePasswordHasher): algorithm, iterations, salt, hash = encoded.split('$', 3) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('iterations', iterations), ('salt', mask_hash(salt)), ('hash', mask_hash(hash)), (_('algorithm'), algorithm), (_('iterations'), iterations), (_('salt'), mask_hash(salt)), (_('hash'), mask_hash(hash)), ]) Loading Loading @@ -263,10 +264,10 @@ class BCryptPasswordHasher(BasePasswordHasher): assert algorithm == self.algorithm salt, checksum = data[:22], data[22:] return SortedDict([ ('algorithm', algorithm), ('work factor', work_factor), ('salt', mask_hash(salt)), ('checksum', mask_hash(checksum)), (_('algorithm'), algorithm), (_('work factor'), work_factor), (_('salt'), mask_hash(salt)), (_('checksum'), mask_hash(checksum)), ]) Loading @@ -292,9 +293,9 @@ class SHA1PasswordHasher(BasePasswordHasher): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('salt', mask_hash(salt, show=2)), ('hash', mask_hash(hash)), (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), ]) Loading @@ -321,8 +322,8 @@ class MD5PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): return SortedDict([ ('algorithm', self.algorithm), ('hash', mask_hash(encoded, show=3)), (_('algorithm'), self.algorithm), (_('hash'), mask_hash(encoded, show=3)), ]) Loading Loading @@ -355,8 +356,8 @@ class CryptPasswordHasher(BasePasswordHasher): algorithm, salt, data = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('salt', salt), ('hash', mask_hash(data, show=3)), (_('algorithm'), algorithm), (_('salt'), salt), (_('hash'), mask_hash(data, show=3)), ]) Loading
django/contrib/auth/forms.py +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ from django.template import loader from django.utils.encoding import smart_str from django.utils.http import int_to_base36 from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext, ugettext_lazy as _ from django.contrib.auth import authenticate from django.contrib.auth.models import User Loading Loading @@ -36,7 +36,7 @@ class ReadOnlyPasswordHashWidget(forms.Widget): summary = "" for key, value in hasher.safe_summary(encoded).iteritems(): summary += "<strong>%(key)s</strong>: %(value)s " % {"key": key, "value": value} summary += "<strong>%(key)s</strong>: %(value)s " % {"key": ugettext(key), "value": value} return mark_safe("<div%(attrs)s>%(summary)s</div>" % {"attrs": flatatt(final_attrs), "summary": summary}) Loading
django/contrib/auth/hashers.py +17 −16 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.utils.encoding import smart_str from django.core.exceptions import ImproperlyConfigured from django.utils.crypto import ( pbkdf2, constant_time_compare, get_random_string) from django.utils.translation import ugettext_noop as _ UNUSABLE_PASSWORD = '!' # This will never be a valid encoded hash Loading Loading @@ -212,10 +213,10 @@ class PBKDF2PasswordHasher(BasePasswordHasher): algorithm, iterations, salt, hash = encoded.split('$', 3) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('iterations', iterations), ('salt', mask_hash(salt)), ('hash', mask_hash(hash)), (_('algorithm'), algorithm), (_('iterations'), iterations), (_('salt'), mask_hash(salt)), (_('hash'), mask_hash(hash)), ]) Loading Loading @@ -263,10 +264,10 @@ class BCryptPasswordHasher(BasePasswordHasher): assert algorithm == self.algorithm salt, checksum = data[:22], data[22:] return SortedDict([ ('algorithm', algorithm), ('work factor', work_factor), ('salt', mask_hash(salt)), ('checksum', mask_hash(checksum)), (_('algorithm'), algorithm), (_('work factor'), work_factor), (_('salt'), mask_hash(salt)), (_('checksum'), mask_hash(checksum)), ]) Loading @@ -292,9 +293,9 @@ class SHA1PasswordHasher(BasePasswordHasher): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('salt', mask_hash(salt, show=2)), ('hash', mask_hash(hash)), (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), ]) Loading @@ -321,8 +322,8 @@ class MD5PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): return SortedDict([ ('algorithm', self.algorithm), ('hash', mask_hash(encoded, show=3)), (_('algorithm'), self.algorithm), (_('hash'), mask_hash(encoded, show=3)), ]) Loading Loading @@ -355,8 +356,8 @@ class CryptPasswordHasher(BasePasswordHasher): algorithm, salt, data = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ ('algorithm', algorithm), ('salt', salt), ('hash', mask_hash(data, show=3)), (_('algorithm'), algorithm), (_('salt'), salt), (_('hash'), mask_hash(data, show=3)), ])