Fixes #2880: Sanitize user password if an exception is raised during login

This commit is contained in:
Jeremy Stretch 2019-02-13 11:34:16 -05:00
parent 95dea1faaa
commit cc3b26998b
2 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,7 @@ v2.5.6 (FUTURE)
* [#2862](https://github.com/digitalocean/netbox/issues/2862) - Follow return URL when connecting a cable * [#2862](https://github.com/digitalocean/netbox/issues/2862) - Follow return URL when connecting a cable
* [#2864](https://github.com/digitalocean/netbox/issues/2864) - Correct display of VRF name when no RD is assigned * [#2864](https://github.com/digitalocean/netbox/issues/2864) - Correct display of VRF name when no RD is assigned
* [#2877](https://github.com/digitalocean/netbox/issues/2877) - Fixed device role label display on light background color * [#2877](https://github.com/digitalocean/netbox/issues/2877) - Fixed device role label display on light background color
* [#2880](https://github.com/digitalocean/netbox/issues/2880) - Sanitize user password if an exception is raised during login
--- ---

View File

@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse from django.urls import reverse
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.http import is_safe_url from django.utils.http import is_safe_url
from django.views.decorators.debug import sensitive_post_parameters
from django.views.generic import View from django.views.generic import View
from secrets.forms import UserKeyForm from secrets.forms import UserKeyForm
@ -23,6 +24,10 @@ from .models import Token
class LoginView(View): class LoginView(View):
template_name = 'login.html' template_name = 'login.html'
@method_decorator(sensitive_post_parameters('password'))
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)
def get(self, request): def get(self, request):
form = LoginForm(request) form = LoginForm(request)