From e053dff6d2c0012cd64620637fad1990a297cff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Mon, 18 Nov 2019 19:49:45 +0100 Subject: [PATCH] [FIX] emc: One route to rule them all It's a problem to use one route for the form and one route for the submission of the form. When user is not logged and he tries to submit with an existing email, a error tell him to sign in before submitting. To login in there is a button that let him sign in. But after loggin in, he comes back to the post url of the form and this url doesn't perform checks that are performed when arriving on the form for the first time. --- easy_my_coop/controllers/main.py | 7 ++++--- easy_my_coop/view/subscription_template.xml | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/easy_my_coop/controllers/main.py b/easy_my_coop/controllers/main.py index acb93b9..4bc9b8a 100644 --- a/easy_my_coop/controllers/main.py +++ b/easy_my_coop/controllers/main.py @@ -32,6 +32,8 @@ class WebsiteSubscription(http.Controller): '/become_cooperator'], type='http', auth="public", website=True) def display_become_cooperator_page(self, **kwargs): + if request.httprequest.method == "POST": + return self.share_subscription(**kwargs) values = {} logged = False if request.env.user.login != 'public': @@ -52,6 +54,8 @@ class WebsiteSubscription(http.Controller): '/become_company_cooperator'], type='http', auth="public", website=True) def display_become_company_cooperator_page(self, **kwargs): + if request.httprequest.method == "POST": + return self.share_subscription(**kwargs) values = {} logged = False @@ -327,9 +331,6 @@ class WebsiteSubscription(http.Controller): } } - @http.route(['/subscription/subscribe_share'], - type='http', - auth="public", website=True) def share_subscription(self, **kwargs): sub_req_obj = request.env['subscription.request'] attach_obj = request.env['ir.attachment'] diff --git a/easy_my_coop/view/subscription_template.xml b/easy_my_coop/view/subscription_template.xml index eab1c2c..d4d40a1 100644 --- a/easy_my_coop/view/subscription_template.xml +++ b/easy_my_coop/view/subscription_template.xml @@ -54,7 +54,7 @@

Become Cooperator


-
+

@@ -90,7 +90,7 @@
@@ -178,8 +178,8 @@ - + t-attf-value="#{city or ''}" placeholder="Bruxelles"/> +
@@ -311,7 +311,7 @@ +
-

+

@@ -319,7 +319,7 @@
-
@@ -341,7 +341,7 @@

Become Cooperator


- +