Browse Source

[IMP] add confirmation email on subscription form

pull/11/head
houssine 5 years ago
parent
commit
90f1e9221a
  1. 13
      easy_my_coop/controllers/main.py
  2. 21
      easy_my_coop/view/subscription_template.xml

13
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', _BLACKLIST = ['id', 'create_uid', 'create_date', 'write_uid', 'write_date',
'user_id', 'active'] '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', 'zip_code', 'country_id', 'phone', 'lang', 'nb_parts',
'total_parts', 'error_msg'] 'total_parts', 'error_msg']
@ -239,6 +239,15 @@ class WebsiteSubscription(http.Controller):
"fill in the form") "fill in the form")
return request.website.render(redirect, values) 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 company = request.website.company_id
if company.allow_id_card_upload: if company.allow_id_card_upload:

21
easy_my_coop/view/subscription_template.xml

@ -77,7 +77,7 @@
t-att-checked="already_cooperator"/> t-att-checked="already_cooperator"/>
</div> </div>
<div name="email_from_container" t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
<div name="email_container" t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="email">Email</label> <label class="col-md-3 col-sm-4 control-label" for="email">Email</label>
<div class="col-md-7 col-sm-8 bottom-line" style="padding-bottom:20px"> <div class="col-md-7 col-sm-8 bottom-line" style="padding-bottom:20px">
<input type="email" class="form-control mandatory-field" name="email" <input type="email" class="form-control mandatory-field" name="email"
@ -85,7 +85,16 @@
t-attf-value="#{email or ''}" placeholder="didier.bourdon@bees-coop.be"/> t-attf-value="#{email or ''}" placeholder="didier.bourdon@bees-coop.be"/>
</div> </div>
</div> </div>
<div name="confirm_email_container" t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="confirm_email">Confirm Email</label>
<div class="col-md-7 col-sm-8 bottom-line" style="padding-bottom:20px">
<input type="confirm_email" class="form-control mandatory-field" name="confirm_email"
required="required" t-att-readonly="logged"
t-attf-value="#{confirm_email or ''}" placeholder="didier.bourdon@bees-coop.be"/>
</div>
</div>
<div t-attf-class="form-group #{error and 'firstname' in error and 'has-error' or ''}"> <div t-attf-class="form-group #{error and 'firstname' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="name">First Name</label> <label class="col-md-3 col-sm-4 control-label" for="name">First Name</label>
<div class="col-md-7 col-sm-8" style="padding-top:5px"> <div class="col-md-7 col-sm-8" style="padding-top:5px">
@ -382,6 +391,14 @@
</div> </div>
</div> </div>
<div t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="confirm_email">Confirm Email</label>
<div class="col-md-7 col-sm-8 bottom-line" style="padding-bottom:20px">
<input type="confirm_email" class="form-control mandatory-field" name="confirm_email"
required="required" t-att-readonly="logged"
t-attf-value="#{confirm_email or ''}" placeholder="didier.bourdon@bees-coop.be"/>
</div>
</div>
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}"> <div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label> <label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label>
<div class="col-md-7 col-sm-8"> <div class="col-md-7 col-sm-8">

Loading…
Cancel
Save