Ignore:
Timestamp:
30 Jan 2015, 11:09:08 (10 years ago)
Author:
Henrik Bettermann
Message:

Customers can use their email address for authentication.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/templates/loginpage.pt

    r12039 r12523  
    22  <br />
    33  <div class="form-group">
    4     <label i18n:translate="" class="col-sm-2 control-label">User Name or Id</label>
     4    <label i18n:translate="" class="col-sm-2 control-label">Identifier</label>
    55    <div class="col-sm-10">
    66      <input name="form.login" type="text" class="form-control" id="login">
     7      <div class="hint" i18n:translate="identifier_hint">Customers can enter
     8      either their customer id, registration number or email address.
     9      Officers must enter their user name.</div>
    710    </div>
    811  </div>
     
    1114    <div class="col-sm-10">
    1215      <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>
    1416    </div>
    1517  </div>
     18  <br />
    1619  <input type="hidden" name="camefrom"   tal:attributes="value view/camefrom" />
    1720  <input class="btn btn-primary" type="submit" name="SUBMIT"
    1821    tal:attributes="value view/login_button" />
    1922  <br /><br /><br />
     23  <p>
     24  All identifiers and passwords are case sensitive.
     25  </p>
    2026  <p  i18n:translate="login_trouble1">Don't forget to logout or exit your browser when you're done.
    2127    If you are having trouble logging in, make sure to enable  cookies in your web browser.
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/authentication.py

    r11997 r12523  
    1 ## $Id: authentication.py 10055 2013-04-04 15:12:43Z uli $
     1## $Id$
    22##
    33## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
     
    2222import time
    2323from zope.component import getUtility
     24from zope.catalog.interfaces import ICatalog
    2425from zope.password.interfaces import IPasswordManager
    2526from zope.pluggableauth.interfaces import (
     
    187188        customer = customerscontainer.get(login, None)
    188189        if customer is None:
    189             return None
     190            cat = getUtility(ICatalog, name='customers_catalog')
     191            results = list(
     192                cat.searchResults(email=(login, login)))
     193            if len(results) != 1:
     194                return None
     195            customer = results[0]
    190196        return IUserAccount(customer)
    191197
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r12521 r12523  
    227227    email = TextLineChoice(
    228228        title = _(u'Email'),
    229         required = False,
     229        required = True,
    230230        constraint=validate_email,
    231231        source = contextual_email_source,
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12521 r12523  
    550550    # Tests for Customer class views and pages
    551551
     552    def test_customer_login_with_email(self):
     553        self.assertEqual(self.customer.state, 'created')
     554        self.browser.open(self.login_path)
     555        self.browser.getControl(name="form.login").value = self.customer.email
     556        self.browser.getControl(name="form.password").value = 'cpwd'
     557        self.browser.getControl("Login").click()
     558        self.assertEqual(self.browser.url, self.customer_path)
     559        self.assertTrue('You logged in' in self.browser.contents)
     560        # Status has changed
     561        self.assertEqual(self.customer.state, 'started')
     562        return
     563
    552564    def test_customer_change_password(self):
    553565        # Customers can change the password
Note: See TracChangeset for help on using the changeset viewer.