Ignore:
Timestamp:
7 Jul 2014, 06:35:58 (10 years ago)
Author:
Henrik Bettermann
Message:

Use lastname (surname) instead of firstname to verify found application record on ApplicantRegistrationPage?.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r11733 r11738  
    11051105        if self.context.mode == 'update':
    11061106            form_fields = grok.AutoFields(IApplicantRegisterUpdate).select(
    1107                 'firstname','reg_number','email')
     1107                'lastname','reg_number','email')
    11081108        else: #if self.context.mode == 'create':
    11091109            form_fields = grok.AutoFields(IApplicantEdit).select(
     
    11491149            # Update applicant
    11501150            reg_number = data.get('reg_number','')
    1151             firstname = data.get('firstname','')
     1151            lastname = data.get('lastname','')
    11521152            cat = getUtility(ICatalog, name='applicants_catalog')
    11531153            results = list(
     
    11551155            if results:
    11561156                applicant = results[0]
    1157                 if getattr(applicant,'firstname',None) is None:
     1157                if getattr(applicant,'lastname',None) is None:
    11581158                    self.flash(_('An error occurred.'), type='danger')
    11591159                    return
    1160                 elif applicant.firstname.lower() != firstname.lower():
     1160                elif applicant.lastname.lower() != lastname.lower():
    11611161                    # Don't tell the truth here. Anonymous must not
    1162                     # know that a record was found and only the firstname
     1162                    # know that a record was found and only the lastname
    11631163                    # verification failed.
    11641164                    self.flash(_('No application record found.'), type='warning')
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r11599 r11738  
    614614        )
    615615
    616     firstname = schema.TextLine(
    617         title = _(u'First Name'),
     616    #firstname = schema.TextLine(
     617    #    title = _(u'First Name'),
     618    #    required = True,
     619    #    )
     620
     621    lastname = schema.TextLine(
     622        title = _(u'Last Name (Surname)'),
    618623        required = True,
    619624        )
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r11729 r11738  
    12101210        self.applicantscontainer.mode = 'update'
    12111211        self.browser.open(self.container_path + '/register')
    1212         self.browser.getControl(name="form.firstname").value = 'John'
     1212        self.browser.getControl(name="form.lastname").value = 'Better'
    12131213        self.browser.getControl(name="form.reg_number").value = 'anynumber'
    12141214        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    12171217            in self.browser.contents)
    12181218        # Even with the correct reg_number we can't register
    1219         # because firstname attribute is not set.
     1219        # because lastname attribute is not set.
    12201220        self.applicantscontainer.mode = 'update'
    12211221        self.browser.open(self.container_path + '/register')
    1222         self.browser.getControl(name="form.firstname").value = 'John'
     1222        self.browser.getControl(name="form.lastname").value = 'Better'
    12231223        self.browser.getControl(name="form.reg_number").value = '1234'
    12241224        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    12271227        # Let's set this attribute manually
    12281228        # and try to register with a wrong name.
    1229         self.applicant.firstname = u'John'
     1229        self.applicant.lastname = u'Better'
    12301230        self.browser.open(self.container_path + '/register')
    1231         self.browser.getControl(name="form.firstname").value = 'Johnny'
     1231        self.browser.getControl(name="form.lastname").value = 'Worse'
    12321232        self.browser.getControl(name="form.reg_number").value = '1234'
    12331233        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    12341234        self.browser.getControl("Send login credentials").click()
    1235         # Anonymous is not informed that firstname verification failed.
     1235        # Anonymous is not informed that lastname verification failed.
    12361236        # It seems that the record doesn't exist.
    12371237        self.assertTrue('No application record found.'
    12381238            in self.browser.contents)
    1239         # Even with the correct firstname we can't register if a
     1239        # Even with the correct lastname we can't register if a
    12401240        # password has been set and used.
    12411241        IWorkflowState(self.applicant).setState('started')
    1242         self.browser.getControl(name="form.firstname").value = 'John'
     1242        self.browser.getControl(name="form.lastname").value = 'Better'
    12431243        self.browser.getControl(name="form.reg_number").value = '1234'
    12441244        self.browser.getControl("Send login credentials").click()
     
    12521252        IWorkflowState(self.applicant).setState('initialized')
    12531253        self.browser.open(self.container_path + '/register')
    1254         # The firstname field, used for verification, is not case-sensitive.
    1255         self.browser.getControl(name="form.firstname").value = 'jOhn'
     1254        # The lastname field, used for verification, is not case-sensitive.
     1255        self.browser.getControl(name="form.lastname").value = 'bEtter'
    12561256        self.browser.getControl(name="form.reg_number").value = '1234'
    12571257        self.browser.getControl(name="form.email").value = 'new@yy.zz'
Note: See TracChangeset for help on using the changeset viewer.