allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [05/17] allura git commit: [#7704] ticket:662 Added email field to registration form
Date Wed, 12 Nov 2014 12:15:08 GMT
[#7704] ticket:662 Added email field to registration form


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

Branch: refs/heads/ib/7704
Commit: 14281829d1757785c970ad6b5cf28445a573ec21
Parents: 9151524
Author: Aleksey 'LXj' Alekseyev <gotletter@gmail.com>
Authored: Tue Oct 7 16:35:22 2014 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Wed Nov 12 10:27:03 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py  | 8 ++++++--
 Allura/allura/lib/widgets/forms.py | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/14281829/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 94a97cc..e3798f1 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -220,14 +220,18 @@ class AuthController(BaseController):
     @expose()
     @require_post()
     @validate(F.registration_form, error_handler=create_account)
-    def save_new(self, display_name=None, username=None, pw=None, **kw):
+    def save_new(self, display_name=None, username=None, pw=None, email=None, **kw):
         if not asbool(config.get('auth.allow_user_registration', True)):
             raise wexc.HTTPNotFound()
         user = M.User.register(
             dict(username=username,
                  display_name=display_name,
-                 password=pw))
+                 password=pw,
+                 email_addresses=[email]))
         plugin.AuthenticationProvider.get(request).login(user)
+        em = M.EmailAddress.create(email)
+        em.claimed_by_user_id = user._id
+        em.send_verification_link()
         flash('User "%s" registered' % username)
         redirect('/')
 

http://git-wip-us.apache.org/repos/asf/allura/blob/14281829/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 89535fb..3d243e2 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -755,6 +755,10 @@ class RegistrationForm(ForgeForm):
                 label='Displayed Name',
                 validator=fev.UnicodeString(not_empty=True)),
             username,
+            ew.TextField(
+                name='email',
+                label='Your e-mail',
+                validator=fev.Email()),
             ew.PasswordField(
                 name='pw',
                 label='New Password',


Mime
View raw message