mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use constant_time_compare for view restriction password checks
This commit is contained in:
parent
1ef36d0420
commit
6d660b0c27
@ -1,4 +1,5 @@
|
||||
from django import forms
|
||||
from django.utils.crypto import constant_time_compare
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
@ -13,7 +14,7 @@ class PasswordViewRestrictionForm(forms.Form):
|
||||
|
||||
def clean_password(self):
|
||||
data = self.cleaned_data['password']
|
||||
if data != self.restriction.password:
|
||||
if not constant_time_compare(data, self.restriction.password):
|
||||
raise forms.ValidationError(_("The password you have entered is not correct. Please try again."))
|
||||
|
||||
return data
|
||||
|
Loading…
Reference in New Issue
Block a user