Ticket #4450: user_change_password.patch

File user_change_password.patch, 1.6 KB (added by Jakub Wiśniowski <news.crumbler@…>, 17 years ago)
  • django/contrib/admin/sites.py

     
    99import cPickle as pickle
    1010import datetime
    1111import md5
     12import re
    1213
    1314ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
    1415LOGIN_FORM_KEY = 'this_is_the_login_form'
     
    110111
    111112        if not self.has_permission(request):
    112113            return self.login(request)
     114
     115        user_change_password = re.compile('auth/user/(\d+)/password')
    113116
    114117        if url == '':
    115118            return self.index(request)
     
    119122            return self.password_change_done(request)
    120123        elif url == 'jsi18n':
    121124            return self.i18n_javascript(request)
     125        elif user_change_password.match(url):
     126            m = user_change_password.match(url)
     127            return self.user_change_password(request, m.group(1))
    122128        elif '/' in url:
    123129            return self.model_page(request, *url.split('/', 2))
    124130
     
    153159        from django.contrib.auth.views import password_change_done
    154160        return password_change_done(request)
    155161
     162    def user_change_password(self, request, id):
     163        """
     164        Handles the "user change password" task
     165        """
     166        from django.contrib.admin.views.auth import user_change_password
     167        return user_change_password(request, id)
     168
    156169    def i18n_javascript(self, request):
    157170        """
    158171        Displays the i18n JavaScript that the Django admin requires.
Back to Top