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:15 UTC

[1/2] git commit: [#7452] ticket:604 Fix template for so that it was impossible to choose mail is not verified and controller

Repository: allura
Updated Branches:
  refs/heads/master 22c610888 -> 18cff87f4


[#7452] ticket:604  Fix template for so that it was impossible to choose mail is not verified and controller


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

Branch: refs/heads/master
Commit: 748684d767e642f9b9c8de2eb13a1af14dbdf16c
Parents: 22c6108
Author: tramzzz <st...@gmail.com>
Authored: Thu Jun 26 18:10:54 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 2 21:01:07 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py           | 4 +++-
 Allura/allura/templates/user_prefs.html     | 6 +++++-
 Allura/allura/tests/functional/test_auth.py | 4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/748684d7/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 7c78a9e..ea17017 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -416,7 +416,9 @@ 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:
-                primary_addr = c.user.email_addresses[0]
+                obj = c.user.address_object(c.user.email_addresses[0])
+                if obj.confirmed:
+                    primary_addr = c.user.email_addresses[0]
             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/748684d7/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 4d86591..d921889 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -81,7 +81,11 @@
             {% for a in c.user.email_addresses %}
             <tr>
               {% set obj = c.user.address_object(a) %}
-              <td>{{lib.radio_button('primary_addr', None, a, c.user.preferences.email_address)}}</td>
+              {% if obj.confirmed %}
+                <td>{{lib.radio_button('primary_addr', None, a, c.user.preferences.email_address)}}</td>
+              {% else %} 
+                <td> <input type="radio" disabled="disabled"></td>
+              {% endif %}
               <td>{{a}}</td>
               {% if obj %}
               <td>

http://git-wip-us.apache.org/repos/asf/allura/blob/748684d7/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 6293c83..4270049 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -113,9 +113,9 @@ 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 changed to remaining address
+        # preferred address has not change if not varifucated
         assert_equal(M.User.query.get(username='test-admin').get_pref('email_address'),
-                     'test@example.com')
+                     None)
 
     @td.with_user_project('test-admin')
     def test_prefs_subscriptions(self):


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

Posted by br...@apache.org.
[#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)