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/10/15 12:56:14 UTC

[04/12] 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/0ca83a63
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0ca83a63
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0ca83a63

Branch: refs/heads/je/42cc_7704
Commit: 0ca83a63bd24b49fe128e7226592bf9eb633703e
Parents: 0371ec5
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Tue Oct 7 18:57:09 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Oct 15 11:24:54 2014 +0300

----------------------------------------------------------------------
 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/0ca83a63/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index ceb1f95..526fb4d 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/0ca83a63/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 32f9b17..f45be91 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -234,6 +234,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/0ca83a63/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 cc6ce56..7e5985b 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -379,7 +379,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(
@@ -388,13 +389,16 @@ 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'}):
@@ -428,7 +432,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