Git Product home page Git Product logo

Comments (1)

karma0 avatar karma0 commented on September 26, 2024

Work-around is as follows; put the overriding logic into your app's view.py file:

from django.core.urlresolvers import reverse
from django.core import signing
from password_reset.views import Recover

class RecoverView(Recover):
    def form_invalid(self, form):
        # We want to make believe that an invalid user/email is actually valid
        user = form.data['username_or_email']
        self.mail_signature = signing.dumps(user, salt=self.url_salt)
        return super(Recover, self).form_valid(form)

    def form_valid(self, form):
        # Overridden so as to not allow for enumeration of email via username
        self.user = form.cleaned_data['user']
        username_or_email = form.data['username_or_email']
        self.send_notification()
        self.mail_signature = signing.dumps(username_or_email,
                                            salt=self.url_salt)
        return super(Recover, self).form_valid(form)

You will also need to override the URL:

url(r'^recover/$', RecoverView.as_view(), name='password_reset_recover'),

_Explantation:_
Both, form_valid and form_invalid have to be overridden, because there is a second enumeration vulnerability in the form_valid function, where upon successful entry of a username that exists in the system will display a message stating that an email was sent to the the entered username's email address. By displaying the email address here, anyone can find a valid user and their email address by attempting password resets with usernames.

The changes made will make it so that the value entered on the reset form is the same value that generates the end URL and is the same value that gets displayed on the (success) results page, and this is what will get displayed whether the username or email is valid or not.

If you would like a pull request with these changes, just say the word.

from django-password-reset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.