Ignore:
Timestamp:
1 Feb 2015, 15:41:30 (10 years ago)
Author:
Henrik Bettermann
Message:

New password can be requested without asking for a identifier.

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  
    7777  ...                               description='A forgetful user', email='aa@aa.ng')
    7878  >>> browser.open('http://localhost/mycompany/changepw')
    79   >>> browser.getControl(name="form.identifier").value = 'forgetful'
    8079  >>> browser.getControl(name="form.email").value = 'aa@aa.ng'
    8180  >>> browser.getControl("Send login credentials").click()
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/interfaces.py

    r12520 r12540  
    170170
    171171    """
    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 
    181172    email = schema.ASCIILine(
    182173        title = _(u'Email Address'),
    183174        required = True,
    184175        constraint=validate_email,
     176        description = _('Enter your email address stored in Ikoba.')
    185177        )
    186178
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py

    r12525 r12540  
    15221522        return
    15231523
    1524     def _searchUser(self, identifier, email):
     1524    def _searchUser(self, email):
    15251525        # Search customer
    15261526        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]
    15341530        # 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]
    15381538        return None
    15391539
     
    15451545            return
    15461546        # Search customer
    1547         identifier = data['identifier']
    15481547        email = data['email']
    1549         user = self._searchUser(identifier, email)
     1548        user = self._searchUser(email)
    15501549        if user is None:
    15511550            self.flash(_('No record found.'), type='warning')
     
    15731572        ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    15741573        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  
    1717  </table>
    1818  <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 email
    23     address stored in Ikoba is wrong or no longer valid,
    24     use the enquiries form to request a change
    25     of address.
    26   </p>
    27   <br />
    2819  <div tal:condition="view/availableActions">
    2920    <input tal:repeat="action view/actions"
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12537 r12540  
    717717    def test_change_password_request(self):
    718718        self.browser.open('http://localhost/app/changepw')
    719         self.browser.getControl(name="form.identifier").value = '123'
    720719        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
    721720        self.browser.getControl("Send login credentials").click()
Note: See TracChangeset for help on using the changeset viewer.