From 90f1e9221affaa7ef8c32d6d1d6ce8401f860544 Mon Sep 17 00:00:00 2001 From: houssine Date: Mon, 5 Aug 2019 13:57:36 +0200 Subject: [PATCH] [IMP] add confirmation email on subscription form --- easy_my_coop/controllers/main.py | 13 +++++++++++-- easy_my_coop/view/subscription_template.xml | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index 3f9b81e..6119736 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -13,8 +13,8 @@ _TECHNICAL = ['view_from', 'view_callback'] _BLACKLIST = ['id', 'create_uid', 'create_date', 'write_uid', 'write_date', 'user_id', 'active'] -_COOP_FORM_FIELD = ['email', 'firstname', 'lastname', 'birthdate', 'iban', - 'share_product_id', 'address', 'city', +_COOP_FORM_FIELD = ['email', 'confirm_email', 'firstname', 'lastname', + 'birthdate', 'iban', 'share_product_id', 'address', 'city', 'zip_code', 'country_id', 'phone', 'lang', 'nb_parts', 'total_parts', 'error_msg'] @@ -239,6 +239,15 @@ class WebsiteSubscription(http.Controller): "fill in the form") return request.website.render(redirect, values) + else: + confirm_email = kwargs.get('confirm_email') + if email != confirm_email: + values = self.fill_values(values, is_company, logged) + values.update(kwargs) + values["error_msg"] = _("The email and the confirmation " + "email doesn't match.Please check " + "the given mail addresses") + return request.website.render(redirect, values) company = request.website.company_id if company.allow_id_card_upload: diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index f68624e..7d4562c 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -77,7 +77,7 @@ t-att-checked="already_cooperator"/> -
+
- + +
+ +
+ +
+
+
@@ -382,6 +391,14 @@
+
+ +
+ +
+