Changeset 6704 for main/waeup.sirp/trunk


Ignore:
Timestamp:
9 Sep 2011, 22:27:18 (13 years ago)
Author:
Henrik Bettermann
Message:

Add attribute to store admission checking access code in student object.

Be more verbose when setting password with access code.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6701 r6704  
    156156        self.reg_number = self.request.form.get('form.reg_number', None)
    157157        # We must not use form.ac_series and form.ac_number in forms since these
    158         # are interpreted by applicant credentials
     158        # are interpreted as applicant credentials in the applicants package
    159159        self.acseries = self.request.form.get('form.acseries', None)
    160160        self.acnumber = self.request.form.get('form.acnumber', None)
     
    170170            self.flash('More than one student found.')
    171171            return
    172         self.student_id = hitlist[0].student_id
    173         student_pw = hitlist[0].context.password
    174         if student_pw:
    175             self.flash('Password has already been set. Please request a password reset.')
    176             return
     172        student = hitlist[0].context
     173        self.student_id = student.student_id
     174        student_pw = student.password
    177175        pin = '%s-%s-%s' % (self.acprefix,self.acseries,self.acnumber)
    178176        code = get_access_code(pin)
     
    180178            self.flash('Access code is invalid.')
    181179            return
     180        if student_pw and pin == student.adm_code:
     181            self.flash('Password has already been set. Your Student Id is %s'
     182                % self.student_id)
     183            return
     184        elif student_pw:
     185            self.flash('Password has already been set.')
     186            return
    182187        # Mark pin as used (this also fires a pin related transition)
    183188        # and set student password
     
    186191            return
    187192        else:
    188             comment = u"AC invalidated"
     193            comment = u"AC invalidated for %s" % self.student_id
    189194            # Here we know that the ac is in state initialized so we do not
    190195            # expect an exception
    191196            #import pdb; pdb.set_trace()
    192197            invalidate_accesscode(pin,comment)
    193             IUserAccount(hitlist[0].context).setPassword(self.acnumber)
     198            IUserAccount(student).setPassword(self.acnumber)
     199        self.flash('Password has been set. Your Student Id is %s'
     200            % self.student_id)
    194201        return
    195202
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6699 r6704  
    6363    #student_id = Attribute('Randomly generated id')
    6464    password = Attribute('Encrypted password of a student')
     65    adm_code = Attribute('Admission checking access code')
    6566
    6667    def loggerInfo(ob_class, comment):
  • main/waeup.sirp/trunk/src/waeup/sirp/students/student.py

    r6699 r6704  
    4646            self.student_id = u'Z654321'
    4747        self.password = None
     48        self.adm_code = None
    4849        return
    4950
Note: See TracChangeset for help on using the changeset viewer.