summaryrefslogtreecommitdiff
path: root/addons/auth_signup/controllers
diff options
context:
space:
mode:
authorDenis Vermylen <dve@odoo.com>2017-06-09 18:45:24 +0200
committerThibault Delavallée <tde@odoo.com>2017-07-06 12:53:39 +0200
commit054c68689b58f554e9433938644f2960720e08ef (patch)
treecd6196a3b8654beee6232d9f604616e97bbca30a /addons/auth_signup/controllers
parent7dd6225f0bbee29f4a138633edd0c16298743518 (diff)
[IMP] auth_signup: various usability improvements in signup process
* allow new signup on invalid token * relabel signup buttons * send a welcome email upon signup with a signup token. This way, should the token somehow be usurped by someone else, the original partner's email address will be notified. (before the usurper can change the email)
Diffstat (limited to 'addons/auth_signup/controllers')
-rw-r--r--addons/auth_signup/controllers/main.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py
index 1ec853f3dee..8f8db0fab0d 100644
--- a/addons/auth_signup/controllers/main.py
+++ b/addons/auth_signup/controllers/main.py
@@ -35,6 +35,16 @@ class AuthSignupHome(Home):
if 'error' not in qcontext and request.httprequest.method == 'POST':
try:
self.do_signup(qcontext)
+ # Send an account creation confirmation email
+ if qcontext.get('token'):
+ user_sudo = request.env['res.users'].sudo().search([('login', '=', qcontext.get('login'))])
+ template = request.env.ref('auth_signup.mail_template_user_signup_account_created', raise_if_not_found=False)
+ if user_sudo and template:
+ template.sudo().with_context(
+ lang=user_sudo.lang,
+ auth_login=werkzeug.url_encode({'auth_login': user_sudo.email}),
+ password=request.params.get('password')
+ ).send_mail(user_sudo.id, force_send=True)
return super(AuthSignupHome, self).web_login(*args, **kw)
except UserError as e:
qcontext['error'] = str(e)