Ticket #17944: ReadOnlyPasswordHashWidget.patch
File ReadOnlyPasswordHashWidget.patch, 1.3 KB (added by , 13 years ago) |
---|
-
django/contrib/auth/forms.py
28 28 29 29 encoded = smart_str(encoded) 30 30 31 if len(encoded) == 32 and '$' not in encoded: 32 hasher = get_hasher('unsalted_md5') 31 try: 32 if len(encoded) == 32 and '$' not in encoded: 33 hasher = get_hasher('unsalted_md5') 34 else: 35 algorithm = encoded.split('$', 1)[0] 36 hasher = get_hasher(algorithm) 37 except ValueError,e: 38 summary = "<strong>%s</strong>" % ugettext('Unknown password hashing algorithm') 33 39 else: 34 algorithm = encoded.split('$', 1)[0] 35 hasher = get_hasher(algorithm) 40 summary = "" 41 for key, value in hasher.safe_summary(encoded).iteritems(): 42 summary += "<strong>%(key)s</strong>: %(value)s " % {"key": ugettext(key), "value": value} 36 43 37 summary = ""38 for key, value in hasher.safe_summary(encoded).iteritems():39 summary += "<strong>%(key)s</strong>: %(value)s " % {"key": ugettext(key), "value": value}40 41 44 return mark_safe("<div%(attrs)s>%(summary)s</div>" % {"attrs": flatatt(final_attrs), "summary": summary}) 42 45 43 46