Changeset 12540 for main/waeup.ikoba/trunk/src/waeup/ikoba
- Timestamp:
- 1 Feb 2015, 15:41:30 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/browser.txt
r12525 r12540 77 77 ... description='A forgetful user', email='aa@aa.ng') 78 78 >>> browser.open('http://localhost/mycompany/changepw') 79 >>> browser.getControl(name="form.identifier").value = 'forgetful'80 79 >>> browser.getControl(name="form.email").value = 'aa@aa.ng' 81 80 >>> browser.getControl("Send login credentials").click() -
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/interfaces.py
r12520 r12540 170 170 171 171 """ 172 identifier = schema.TextLine(173 title = _(u'Unique Identifier'),174 description = _(175 u'User Name, Customer Id or '176 u'Registration Number'),177 required = True,178 readonly = False,179 )180 181 172 email = schema.ASCIILine( 182 173 title = _(u'Email Address'), 183 174 required = True, 184 175 constraint=validate_email, 176 description = _('Enter your email address stored in Ikoba.') 185 177 ) 186 178 -
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py
r12525 r12540 1522 1522 return 1523 1523 1524 def _searchUser(self, identifier,email):1524 def _searchUser(self, email): 1525 1525 # Search customer 1526 1526 cat = queryUtility(ICatalog, name='customers_catalog') 1527 results = cat.searchResults( 1528 reg_number=(identifier, identifier), 1529 email=(email,email)) 1530 for result in results: 1531 if result.customer_id == identifier \ 1532 or result.reg_number == identifier: 1533 return result 1527 results = list(cat.searchResults(email=(email,email))) 1528 if len(results) == 1: 1529 return results[0] 1534 1530 # Search portal user 1535 user = grok.getSite()['users'].get(identifier, None) 1536 if user is not None and user.email == email: 1537 return user 1531 users = grok.getSite()['users'].values() 1532 results = [] 1533 for user in users: 1534 if user.email == email: 1535 results.append(user) 1536 if len(results) == 1: 1537 return results[0] 1538 1538 return None 1539 1539 … … 1545 1545 return 1546 1546 # Search customer 1547 identifier = data['identifier']1548 1547 email = data['email'] 1549 user = self._searchUser( identifier,email)1548 user = self._searchUser(email) 1550 1549 if user is None: 1551 1550 self.flash(_('No record found.'), type='warning') … … 1573 1572 ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','') 1574 1573 self.context.logger.info( 1575 '%s - %s - %s' % (ob_class, data['identifier'], data['email']))1576 return 1574 '%s - %s - %s' % (ob_class, IUserAccount(user).name, data['email'])) 1575 return -
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/templates/changepw.pt
r12520 r12540 17 17 </table> 18 18 <br /> 19 <p i18n:translate="email_address_problem">20 Enter the email address stored in Ikoba.21 You can't change your email address here.22 If you've forgotten your email address or the email23 address stored in Ikoba is wrong or no longer valid,24 use the enquiries form to request a change25 of address.26 </p>27 <br />28 19 <div tal:condition="view/availableActions"> 29 20 <input tal:repeat="action view/actions" -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12537 r12540 717 717 def test_change_password_request(self): 718 718 self.browser.open('http://localhost/app/changepw') 719 self.browser.getControl(name="form.identifier").value = '123'720 719 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 721 720 self.browser.getControl("Send login credentials").click()
Note: See TracChangeset for help on using the changeset viewer.