You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/11/10 10:37:28 UTC

[02/12] allura git commit: [#7704] ticket:662 Set pending status on registration

[#7704] ticket:662 Set pending status on registration


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/5e9fa610
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5e9fa610
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5e9fa610

Branch: refs/heads/ib/7704
Commit: 5e9fa6104de398bba9ddc07d85fa581dae6a36aa
Parents: 059dd96
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Tue Oct 7 18:57:09 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Nov 4 13:52:15 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py           |  3 ++-
 Allura/allura/model/auth.py                 |  1 +
 Allura/allura/tests/functional/test_auth.py | 11 ++++++++---
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5e9fa610/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index e3798f1..5d966a1 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -227,7 +227,8 @@ class AuthController(BaseController):
             dict(username=username,
                  display_name=display_name,
                  password=pw,
-                 email_addresses=[email]))
+                 email_addresses=[email],
+                 pending=True))
         plugin.AuthenticationProvider.get(request).login(user)
         em = M.EmailAddress.create(email)
         em.claimed_by_user_id = user._id

http://git-wip-us.apache.org/repos/asf/allura/blob/5e9fa610/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 74fcd24..ee2793b 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -248,6 +248,7 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable):
     tool_preferences = FieldProperty(S.Deprecated)
     tool_data = FieldProperty({str: {str: None}})  # entry point: prefs dict
     disabled = FieldProperty(bool, if_missing=False)
+    pending = FieldProperty(bool, if_missing=False)
 
     # Don't use these directly, use get/set_pref() instead
     preferences = FieldProperty(dict(

http://git-wip-us.apache.org/repos/asf/allura/blob/5e9fa610/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 add0a16..4a2b52b 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -537,7 +537,8 @@ class TestAuth(TestController):
                               username='aaa',
                               pw='12345678',
                               pw2='12345678',
-                              display_name='Test Me'))
+                              display_name='Test Me',
+                              email='test@example.com'))
         r = r.follow()
         assert 'User "aaa" registered' in unentity(r.body)
         r = self.app.post('/auth/save_new',
@@ -545,12 +546,15 @@ class TestAuth(TestController):
                               username='aaa',
                               pw='12345678',
                               pw2='12345678',
-                              display_name='Test Me'))
+                              display_name='Test Me',
+                              email='test@example.com'))
         assert 'That username is already taken. Please choose another.' in r
         r = self.app.get('/auth/logout')
         r = self.app.post('/auth/do_login',
                           params=dict(username='aaa', password='12345678'),
                           status=302)
+        user = M.User.query.get(username='aaa')
+        assert user.pending
 
     def test_create_account_disabled_header_link(self):
         with h.push_config(config, **{'auth.allow_user_registration': 'false'}):
@@ -582,7 +586,8 @@ class TestAuth(TestController):
             username='aaa',
             pw='12345678',
             pw2='12345678',
-            display_name='Test Me')).follow()
+            display_name='Test Me',
+            email='test@example.com')).follow()
         user = M.User.query.get(username='aaa')
         assert M.ProjectRole.query.find(
             dict(user_id=user._id, project_id=p._id)).count() == 0