Custom Search

Wednesday, January 8, 2014

Latest Django ReadOnlyPasswordHashWidget Changed the format of password displaying in the change or edit mode

This is the how latest version of django displaying the password filed in the edit mode.

algorithm: sha1 salt: b3*** hash: 21c9a0********************************** 
 
 
1)
For More info, See the File
Django-1.5-py2.7.egg/django/contrib/auth/forms.py
 
class ReadOnlyPasswordHashWidget(forms.Widget):
    def render(self, name, value, attrs):
        encoded = value
        final_attrs = self.build_attrs(attrs)

        if not encoded or encoded == UNUSABLE_PASSWORD:
            summary = mark_safe("%s" % ugettext("No password set."))
        else:
            try:
                hasher = identify_hasher(encoded)
            except ValueError:
                summary = mark_safe("%s" % ugettext(
                    "Invalid password format or unknown hashing algorithm."))
            else:
                summary = format_html_join('',
                                           "{0}: {1} ",
                                           ((ugettext(key), value)
                                            for key, value in hasher.safe_summary(encoded).items())
                                           )


        return format_html("
{1}
", flatatt(final_attrs), summary)

No comments:

Post a Comment