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/11/17 20:43:08 UTC
[02/15] allura git commit: [#7704] ticket:662 Added email field to
registration form
[#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/edb3d5d0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/edb3d5d0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/edb3d5d0
Branch: refs/heads/master
Commit: edb3d5d0be87dc85268aff2c2b37dfbcd7dde442
Parents: 4d9f918
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Tue Oct 7 16:35:22 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Nov 17 19:18:01 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/edb3d5d0/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/edb3d5d0/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',