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:52:50 UTC

[1/3] git commit: [#7523] add option to require an email address, which prevents deleting your last verified addr

Repository: allura
Updated Branches:
  refs/heads/db/7523 [created] a8a99ff5f


[#7523] 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/a37d708a
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a37d708a
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a37d708a

Branch: refs/heads/db/7523
Commit: a37d708a62155faba9ceb164ae844da6dc7d6a08
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:49:46 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/a37d708a/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/a37d708a/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


[2/3] git commit: [#7523] tell user verification email is coming, so they dont click the verify link and reset the hash

Posted by br...@apache.org.
[#7523] 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/afc2339d
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/afc2339d
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/afc2339d

Branch: refs/heads/db/7523
Commit: afc2339de9d5929f8111ace7723108e20f49bf5d
Parents: a37d708
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:49:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/afc2339d/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:


[3/3] git commit: [#7523] change landing URL after email verification

Posted by br...@apache.org.
[#7523] change landing URL after email verification


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

Branch: refs/heads/db/7523
Commit: a8a99ff5f29a1215df4304b4c4cb3358b7c6c899
Parents: afc2339
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Jul 2 21:49:38 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 2 21:50:02 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a8a99ff5/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index b13a3e7..7a3939d 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -235,7 +235,7 @@ class AuthController(BaseController):
             flash('Email address confirmed')
         else:
             flash('Unknown verification link', 'error')
-        redirect('/')
+        redirect('/auth/preferences/')
 
     @expose()
     def logout(self):