Changeset 8627


Ignore:
Timestamp:
5 Jun 2012, 06:04:00 (12 years ago)
Author:
Henrik Bettermann
Message:

Do not block application record if password has been set for the first time and
let students re-use the ApplicantRegistrationPage? in case they have entered a wrong
email address.

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

Legend:

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

    r8589 r8627  
    10341034                    self.flash(_('No application record found.'))
    10351035                    return
    1036                 elif applicant.password is not None:
    1037                     self.flash(_('Your password has already been set. '
     1036                elif applicant.password is not None and \
     1037                    applicant.state != INITIALIZED:
     1038                    self.flash(_('Your password has already been set and used. '
    10381039                                 'Please proceed to the login page.'))
    10391040                    return
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r8602 r8627  
    489489        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    490490        self.fill_correct_values()
     491        self.assertTrue(IUserAccount(self.applicant).checkPassword('apwd'))
    491492        self.browser.getControl("Save").click()
    492493        self.assertMatches('...Form has been saved...', self.browser.contents)
     
    931932        self.assertTrue('No application record found.'
    932933            in self.browser.contents)
    933         # Even with the correct firstname we can't register because
    934         # password has already been set.
     934        # Even with the correct firstname we can't register if a
     935        # password has been set and used.
     936        IWorkflowState(self.applicant).setState('started')
    935937        self.browser.getControl(name="form.firstname").value = 'John'
    936938        self.browser.getControl(name="form.reg_number").value = '1234'
    937939        self.browser.getControl("Get login credentials").click()
    938         self.assertTrue('Your password has already been set.'
     940        self.assertTrue('Your password has already been set and used.'
    939941            in self.browser.contents)
    940         # We unset the password and try to register again.
    941         IUserAccount(
    942             self.app['applicants']['app2009'][
    943             self.applicant.application_number]).context.password = None
     942        #IUserAccount(
     943        #    self.app['applicants']['app2009'][
     944        #    self.applicant.application_number]).context.password = None
     945        # Even without unsetting the password we can re-register if state
     946        # is 'initialized'
     947        IWorkflowState(self.applicant).setState('initialized')
    944948        self.browser.open(self.container_path + '/register')
    945949        # The firstname field, used for verification, is not case-sensitive.
    946950        self.browser.getControl(name="form.firstname").value = 'jOhn'
    947951        self.browser.getControl(name="form.reg_number").value = '1234'
    948         self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     952        self.browser.getControl(name="form.email").value = 'new@yy.zz'
    949953        self.browser.getControl("Get login credentials").click()
    950954        # Yeah, we succeded ...
     
    955959        results = list(
    956960            cat.searchResults(
    957             email=('xx@yy.zz', 'xx@yy.zz')))
     961            email=('new@yy.zz', 'new@yy.zz')))
    958962        self.assertEqual(self.applicant,results[0])
    959963        return
Note: See TracChangeset for help on using the changeset viewer.