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:38:45 UTC
[1/4] 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/db/7452 [created] 03a196f38
[#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/db/7452
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):
[3/4] git commit: [#7452] add option to require an email address,
which prevents deleting your last verified addr
Posted by br...@apache.org.
[#7452] add option to require an email address, which prevents deleting your last verified addr
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/284b7306
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/284b7306
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/284b7306
Branch: refs/heads/db/7452
Commit: 284b73062e7794a59c0deefc70a75a0849d9c10f
Parents: 18cff87
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Jul 2 20:59:49 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 2 21:01:24 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 23 ++++++++++++++++-------
Allura/development.ini | 1 +
2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/284b7306/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 2e52b2c..43d75c9 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -366,6 +366,13 @@ class AuthController(BaseController):
redirect('/')
+def select_new_primary_addr(user, ignore_emails=[]):
+ for obj_e in user.email_addresses:
+ obj = user.address_object(obj_e)
+ if obj and obj.confirmed and obj_e not in ignore_emails:
+ return obj_e
+
+
class PreferencesController(BaseController):
def _check_security(self):
@@ -400,8 +407,14 @@ class PreferencesController(BaseController):
obj = c.user.address_object(old_a)
if data.get('delete') or not obj:
if primary_addr == c.user.email_addresses[i]:
- c.user.set_pref('email_address', None)
- primary_addr = None
+ if select_new_primary_addr(c.user, ignore_emails=primary_addr) is None \
+ and asbool(config.get('auth.require_email_addr', False)):
+ flash('You must have at least one verified email address.', 'error')
+ redirect('.')
+ else:
+ # clear it now, a new one will get set below
+ c.user.set_pref('email_address', None)
+ primary_addr = None
del c.user.email_addresses[i]
if obj:
obj.delete()
@@ -416,11 +429,7 @@ 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:
- for obj_e in c.user.email_addresses:
- obj = c.user.address_object(obj_e)
- if obj:
- if obj.confirmed:
- primary_addr = obj_e
+ primary_addr = select_new_primary_addr(c.user)
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/284b7306/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index a410994..0049945 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -102,6 +102,7 @@ auth.allow_edit_prefs = true
auth.allow_password_change = true
auth.allow_upload_ssh_key = false
auth.allow_user_messages_config = true
+auth.require_email_addr = true
# In seconds
auth.recovery_hash_expiry_period = 600
[4/4] git commit: [#7452] tell user verification email is coming,
so they dont click the verify link and reset the hash
Posted by br...@apache.org.
[#7452] tell user verification email is coming, so they dont click the verify link and reset the hash
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/03a196f3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/03a196f3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/03a196f3
Branch: refs/heads/db/7452
Commit: 03a196f385792d8e103b9170b08036ce97226ed4
Parents: 284b730
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Jul 2 21:00:19 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 2 21:01:25 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/03a196f3/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 43d75c9..b13a3e7 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -426,6 +426,7 @@ class PreferencesController(BaseController):
em = M.EmailAddress.upsert(new_addr['addr'])
em.claimed_by_user_id = c.user._id
em.send_verification_link()
+ flash('A verification email has been sent. Please check your email and click to confirm.')
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:
[2/4] 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/db/7452
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)