You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/07/02 23:47:16 UTC

[2/2] git commit: [#7452] ticket:604 fixed update view to pick first verified email address

[#7452] ticket:604 fixed update view to pick first verified email address


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

Branch: refs/heads/master
Commit: 18cff87f4bcaf8c5514a7638c9d470df62268f46
Parents: 748684d
Author: tramzzz <st...@gmail.com>
Authored: Mon Jun 30 16:01:21 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 2 21:01:22 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py           | 8 +++++---
 Allura/allura/tests/functional/test_auth.py | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/18cff87f/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index ea17017..2e52b2c 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -416,9 +416,11 @@ class PreferencesController(BaseController):
                 else:
                     flash('Email address %s is invalid' % new_addr['addr'], 'error')
             if not primary_addr and not c.user.get_pref('email_address') and c.user.email_addresses:
-                obj = c.user.address_object(c.user.email_addresses[0])
-                if obj.confirmed:
-                    primary_addr = c.user.email_addresses[0]
+                for obj_e in c.user.email_addresses:
+                    obj = c.user.address_object(obj_e)
+                    if obj:
+                        if obj.confirmed:
+                            primary_addr = obj_e
             if primary_addr:
                 c.user.set_pref('email_address', primary_addr)
             for k, v in preferences.iteritems():

http://git-wip-us.apache.org/repos/asf/allura/blob/18cff87f/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 4270049..408d8f7 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -113,7 +113,7 @@ class TestAuth(TestController):
             extra_environ=dict(username='test-admin'))
         r = self.app.get('/auth/preferences/')
         assert 'test-admin@users.localhost' not in r
-        # preferred address has not change if not varifucated
+        # preferred address has not changed if email is not verified
         assert_equal(M.User.query.get(username='test-admin').get_pref('email_address'),
                      None)