Skip to content

Commit 973fe7a

Browse files
committed
Simplify honeypot submission checks
1 parent 1d46eaa commit 973fe7a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

wagtail_honeypot/models.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ def process_form_submission(self, form):
3636
return super().process_form_submission(form)
3737

3838
# honeypot enabled
39-
score = []
4039
if honeypot_name_field in form.data and honeypot_time_field in form.data:
41-
score.append(form.data[honeypot_name_field] == "")
42-
score.append(self.time_diff(form.data[honeypot_time_field], honeypot_time_interval))
43-
return super().process_form_submission(form) if len(score) and all(score) else None
40+
is_empty = form.data[honeypot_name_field] == ""
41+
is_delayed = self.time_diff(form.data[honeypot_time_field], honeypot_time_interval)
42+
return super().process_form_submission(form) if is_empty and is_delayed else None
4443

4544
@staticmethod
4645
def time_diff(value, interval):

0 commit comments

Comments
 (0)