Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 09CC3200CC9 for ; Mon, 17 Jul 2017 17:59:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 080DA163373; Mon, 17 Jul 2017 15:59:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E6EB163346 for ; Mon, 17 Jul 2017 17:58:59 +0200 (CEST) Received: (qmail 64959 invoked by uid 500); 17 Jul 2017 15:58:58 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 64948 invoked by uid 99); 17 Jul 2017 15:58:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 15:58:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2355CDFAB2; Mon, 17 Jul 2017 15:58:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kentontaylor@apache.org To: commits@allura.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: allura git commit: [#8158] Minor fixups to antispam-enabled login Date: Mon, 17 Jul 2017 15:58:56 +0000 (UTC) archived-at: Mon, 17 Jul 2017 15:59:00 -0000 Repository: allura Updated Branches: refs/heads/kt/antispam_login c92a238fa -> 728bd7256 [#8158] Minor fixups to antispam-enabled login Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/728bd725 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/728bd725 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/728bd725 Branch: refs/heads/kt/antispam_login Commit: 728bd7256455e50bc5c7ee9ced11dfdb29c1521e Parents: c92a238 Author: Kenton Taylor Authored: Mon Jul 17 15:52:23 2017 +0000 Committer: Kenton Taylor Committed: Mon Jul 17 15:52:23 2017 +0000 ---------------------------------------------------------------------- Allura/allura/lib/widgets/auth_widgets.py | 7 +++---- Allura/allura/tests/functional/test_auth.py | 9 ++++----- AlluraTest/alluratest/validation.py | 6 +----- 3 files changed, 8 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/728bd725/Allura/allura/lib/widgets/auth_widgets.py ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/widgets/auth_widgets.py b/Allura/allura/lib/widgets/auth_widgets.py index 566d8e1..7bac270 100644 --- a/Allura/allura/lib/widgets/auth_widgets.py +++ b/Allura/allura/lib/widgets/auth_widgets.py @@ -55,10 +55,9 @@ class LoginForm(ForgeForm): text='' 'Forgot password?')) - if g.antispam: - for fld in g.antispam.extra_fields(): - fields.append( - ew_core.Widget(template=ew.Snippet(fld))) + for fld in g.antispam.extra_fields(): + fields.append( + ew_core.Widget(template=ew.Snippet(fld))) return fields http://git-wip-us.apache.org/repos/asf/allura/blob/728bd725/Allura/allura/tests/functional/test_auth.py ---------------------------------------------------------------------- diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py index 0918ca9..64b4da5 100644 --- a/Allura/allura/tests/functional/test_auth.py +++ b/Allura/allura/tests/functional/test_auth.py @@ -81,10 +81,9 @@ class TestAuth(TestController): assert_equal(r.headers['Location'], 'http://localhost/') with assert_raises(ValueError) as ex: - with audits('Honeypot login', user=True): - r = self.app.post('/auth/do_login', antispam=True, params=dict( - username='test-user', password='foo', honey1='robot', - _session_id=self.app.cookies['_session_id'])) + r = self.app.post('/auth/do_login', antispam=True, params=dict( + username='test-user', password='foo', honey1='robot', + _session_id=self.app.cookies['_session_id'])) with audits('Failed login', user=True): r = self.app.post('/auth/do_login', antispam=True, params=dict( @@ -2036,7 +2035,7 @@ class TestCSRFProtection(TestController): antispam=True) # regular form submit - r = self.app.get('/admin/overview') # ahh i'm dead here + r = self.app.get('/admin/overview') r = r.form.submit() assert_equal(r.location, 'http://localhost/admin/overview') http://git-wip-us.apache.org/repos/asf/allura/blob/728bd725/AlluraTest/alluratest/validation.py ---------------------------------------------------------------------- diff --git a/AlluraTest/alluratest/validation.py b/AlluraTest/alluratest/validation.py index c0f475e..23ac398 100644 --- a/AlluraTest/alluratest/validation.py +++ b/AlluraTest/alluratest/validation.py @@ -213,12 +213,8 @@ def validate_page(html_or_response): class AntiSpamTestApp(TestApp): - def __init__(self, *args): - self.antispam = utils.AntiSpam() - super(AntiSpamTestApp, self).__init__(*args) - def post(self, *args, **kwargs): - antispam = self.antispam + antispam = utils.AntiSpam() if kwargs.pop('antispam', False): params = { 'timestamp': antispam.timestamp_text,