- Timestamp:
- 23 Nov 2014, 16:54:27 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/templates/loginpage.pt
r11952 r12039 11 11 <div class="col-sm-10"> 12 12 <input name="form.password" type="password" class="form-control" id="password"> 13 <font i18n:translate="" color="red"> Notice: User names, Ids and passwords are case sensitive.</font>13 <font i18n:translate="" color="red"> Notice: User names, ids and passwords are case sensitive.</font> 14 14 </div> 15 15 </div> … … 22 22 </p> 23 23 <p i18n:translate="login_trouble2" tal:condition="python:False"> 24 You don't have an account because you are a new customer, or your customer record has just been created?24 You don't have an account because you are a new customer, or your customer record has been created for you? 25 25 Acquire a Password Activation Code (PWD) and inititialize your customer account 26 26 <strong><a href ="setpassword"> here</a></strong>. 27 27 </p> 28 28 <p i18n:translate="login_trouble4"> 29 You don't have an account because you are a new customer, or your customer record has just been created? 29 You don't have an account because you are a new customer? 30 Create your customer account <strong><a href="createaccount"> here</a></strong>. 31 </p> 32 <p i18n:translate="login_trouble5"> 33 You don't have an account because you are a new customer and your customer record has been created for you? 30 34 Inititialize your customer account <strong><a href="requestpw"> here</a></strong>. 31 35 </p> 32 <p i18n:translate="login_trouble3"> Or simply forgot your customer idpassword? Then request a new password36 <p i18n:translate="login_trouble3"> Or simply forgot your id or password? Then request a new password 33 37 <strong><a href="changepw"> here</a></strong>. 34 38 </p> -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12035 r12039 47 47 from waeup.ikoba.customers.interfaces import ( 48 48 ICustomer, ICustomersContainer, ICustomerRequestPW, ICustomersUtils, 49 ICustomerDocument, ICustomerDocumentsContainer 49 ICustomerDocument, ICustomerDocumentsContainer, ICustomerCreate 50 50 ) 51 51 from waeup.ikoba.customers.catalog import search … … 467 467 468 468 class CustomerRequestPasswordPage(IkobaAddFormPage): 469 """Captcha'd registration page for applicants.469 """Captcha'd password request page for customers. 470 470 """ 471 471 grok.name('requestpw') 472 472 grok.require('waeup.Anonymous') 473 473 grok.template('requestpw') 474 form_fields = grok.AutoFields(ICustomerRequestPW).select( 475 'firstname','number','email') 474 form_fields = grok.AutoFields(ICustomerRequestPW) 476 475 label = _('Request password for first-time login') 477 476 … … 484 483 485 484 def _redirect(self, email, password, customer_id): 486 # Forward only email to landing page in base package.485 # Forward only email address to landing page in base package. 487 486 self.redirect(self.url(self.context, 'requestpw_complete', 488 487 data=dict(email=email))) … … 554 553 555 554 555 class CustomerCreateAccountPage(IkobaAddFormPage): 556 """Captcha'd account creation page for customers. 557 """ 558 grok.name('createaccount') 559 grok.require('waeup.Anonymous') 560 grok.template('createaccount') 561 form_fields = grok.AutoFields(ICustomerCreate) 562 label = _('Create customer account') 563 564 def update(self): 565 # Handle captcha 566 self.captcha = getUtility(ICaptchaManager).getCaptcha() 567 self.captcha_result = self.captcha.verify(self.request) 568 self.captcha_code = self.captcha.display(self.captcha_result.error_code) 569 return 570 571 def _redirect(self, email, password, customer_id): 572 # Forward only email address to landing page in base package. 573 self.redirect(self.url(self.context, 'requestpw_complete', 574 data=dict(email=email))) 575 return 576 577 @action(_('Send login credentials to email address'), style='primary') 578 def create_account(self, **data): 579 if not self.captcha_result.is_valid: 580 # Captcha will display error messages automatically. 581 # No need to flash something. 582 return 583 customer = createObject(u'waeup.Customer') 584 customer.firstname = data.get('firstname','') 585 customer.middlename = data.get('middlename','') 586 customer.lastname = data.get('lastname','') 587 customer.email = data.get('email','') 588 self.context['customers'].addCustomer(customer) 589 ikoba_utils = getUtility(IIkobaUtils) 590 password = ikoba_utils.genPassword() 591 mandate = PasswordMandate() 592 mandate.params['password'] = password 593 mandate.params['user'] = customer 594 site = grok.getSite() 595 site['mandates'].addMandate(mandate) 596 # Send email with credentials 597 args = {'mandate_id':mandate.mandate_id} 598 mandate_url = self.url(site) + '/mandate?%s' % urlencode(args) 599 url_info = u'Confirmation link: %s' % mandate_url 600 msg = _('You have successfully created a customer account for the') 601 if ikoba_utils.sendCredentials(IUserAccount(customer), 602 password, url_info, msg): 603 email_sent = customer.email 604 else: 605 email_sent = None 606 self._redirect(email=email_sent, password=password, 607 customer_id=customer.customer_id) 608 ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','') 609 self.context.logger.info( 610 '%s - %s - %s' % (ob_class, customer.customer_id, email_sent)) 611 return 612 613 556 614 class CustomerRequestPasswordEmailSent(IkobaPage): 557 615 """Landing page after successful password request. … … 561 619 grok.require('waeup.Public') 562 620 grok.template('requestpwmailsent') 563 label = _('Your passwordrequest was successful.')621 label = _('Your request was successful.') 564 622 565 623 def update(self, email=None, customer_id=None, password=None): -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/changepassword.pt
r11979 r12039 21 21 </tbody> 22 22 </table> 23 <br /> 23 24 24 25 <div tal:condition="view/availableActions"> -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/requestpw.pt
r11996 r12039 21 21 To be able to proceed you must provide a valid email address! 22 22 </p> 23 <br /> 23 24 <div tal:condition="view/availableActions"> 24 25 <input tal:repeat="action view/actions" -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12018 r12039 205 205 206 206 207 class ICustomerRequestPW(I Customer):208 """Representation of a ncustomer for first-time password request.207 class ICustomerRequestPW(IIkobaObject): 208 """Representation of a customer for first-time password request. 209 209 210 210 This interface is used when customers use the requestpw page to … … 228 228 229 229 230 class ICustomerCreate(IIkobaObject): 231 """Representation of an customer for account creation. 232 233 This interface is used when customers use the createaccount page. 234 """ 235 236 firstname = schema.TextLine( 237 title = _(u'First Name'), 238 required = True, 239 ) 240 241 middlename = schema.TextLine( 242 title = _(u'Middle Name'), 243 required = False, 244 ) 245 246 lastname = schema.TextLine( 247 title = _(u'Last Name (Surname)'), 248 required = True, 249 ) 250 251 email = schema.ASCIILine( 252 title = _(u'Email Address'), 253 required = True, 254 constraint=validate_email, 255 ) 256 257 230 258 # Customer document interfaces 231 259 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12038 r12039 703 703 self.browser.getControl("Send login credentials").click() 704 704 # Yeah, we succeded ... 705 self.assertTrue('Your passwordrequest was successful.'705 self.assertTrue('Your request was successful.' 706 706 in self.browser.contents) 707 707 # ... and customer can be found in the catalog via the email address
Note: See TracChangeset for help on using the changeset viewer.