From 054c68689b58f554e9433938644f2960720e08ef Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Fri, 9 Jun 2017 18:45:24 +0200 Subject: [PATCH] [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) --- addons/auth_signup/controllers/main.py | 10 +++++ addons/auth_signup/data/auth_signup_data.xml | 44 +++++++++++++++++++ .../views/auth_signup_login_templates.xml | 6 +-- 3 files changed, 57 insertions(+), 3 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) diff --git a/addons/auth_signup/data/auth_signup_data.xml b/addons/auth_signup/data/auth_signup_data.xml index 2b6ceeeed79..b9f88893d2a 100644 --- a/addons/auth_signup/data/auth_signup_data.xml +++ b/addons/auth_signup/data/auth_signup_data.xml @@ -91,5 +91,49 @@ + + + Auth Signup: Odoo Account Created + + "${object.company_id.name|safe}" <${(object.company_id.email or user.email)|safe}> + ${object.email|safe} + Welcome to ${object.company_id.name}! + +
+ + + + +
+ ${user.company_id.name} +
+
+
+

Dear ${object.name},

+

+ Your account has been successfully created! +

+

+ Your login: ${object.email} +
+ Your password: ${ctx['password']} +

+

+ To gain access to your account, you can use the following link: +

+ +

Best regards,

+
+
+ ${user.signature | safe} +

+ Sent by ${user.company_id.name} using Odoo +

+
+ +
+ diff --git a/addons/auth_signup/views/auth_signup_login_templates.xml b/addons/auth_signup/views/auth_signup_login_templates.xml index b3e17efac90..a38596abe9c 100644 --- a/addons/auth_signup/views/auth_signup_login_templates.xml +++ b/addons/auth_signup/views/auth_signup_login_templates.xml @@ -2,7 +2,7 @@ @@ -40,7 +40,7 @@ - +

@@ -49,7 +49,7 @@