allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8158] Minor fixups to antispam-enabled login
Date Mon, 17 Jul 2017 15:58:56 GMT
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 <ktaylor@slashdotmedia.com>
Authored: Mon Jul 17 15:52:23 2017 +0000
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
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='<a href="/auth/forgotten_password" style="margin-left:162px"
target="_top">'
                          'Forgot password?</a>'))
 
-        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,


Mime
View raw message