Changeset 6758 for main/waeup.sirp/trunk


Ignore:
Timestamp:
14 Sep 2011, 01:56:26 (13 years ago)
Author:
uli
Message:

Use more simple form names, fix nesting errors, etc.

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

    r6756 r6758  
    151151    title = ''
    152152    label = 'Set password for first-time login'
    153     acprefix = 'PWD'
     153    ac_prefix = 'PWD'
    154154    pnav = 0
    155155
    156156    def update(self, SUBMIT=None):
    157         self.reg_number = self.request.form.get('form.reg_number', None)
    158         # We must not use form.ac_series and form.ac_number in forms since these
    159         # are interpreted as applicant credentials in the applicants package
    160         self.acseries = self.request.form.get('form.acseries', None)
    161         self.acnumber = self.request.form.get('form.acnumber', None)
     157        self.reg_number = self.request.form.get('reg_number', None)
     158        self.ac_series = self.request.form.get('ac_series', None)
     159        self.ac_number = self.request.form.get('ac_number', None)
    162160
    163161        if SUBMIT is None:
     
    174172        self.student_id = student.student_id
    175173        student_pw = student.password
    176         pin = '%s-%s-%s' % (self.acprefix,self.acseries,self.acnumber)
     174        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
    177175        code = get_access_code(pin)
    178176        if not code:
     
    197195            #import pdb; pdb.set_trace()
    198196            invalidate_accesscode(pin,comment)
    199             IUserAccount(student).setPassword(self.acnumber)
     197            IUserAccount(student).setPassword(self.ac_number)
    200198        self.flash('Password has been set. Your Student Id is %s'
    201199            % self.student_id)
     
    657655    form_fields = grok.AutoFields(
    658656        IStudentClearanceEdit).omit('clearance_locked')
    659     #grok.template('clearanceeditpage')
    660657    label = 'Edit clearance data'
    661658    title = 'Clearance Data'
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/setpassword.pt

    r6717 r6758  
    1 <h2 i18n:translate=""  tal:condition="view/label"  tal:content="view/label">Label</h2>
     1<h2 i18n:translate=""  tal:condition="view/label"
     2    tal:content="view/label">Label</h2>
    23<form method="POST">
    3   <input type="hidden" name="form.acprefix"  value="" tal:attributes="value view/acprefix" />
    44  <table>
    55    <tbody>
    6       <tr> <td>
    7           <label for="form.reg_number">Registration Number:
     6      <tr><td>
     7          <label for="reg_number">Registration Number:
    88          </label></td> <td>
    9           <input name="form.reg_number" type="text" size="15" maxlength="15"  value="" tal:attributes="value view/reg_number"/> </td>
     9          <input name="reg_number" type="text" size="15" maxlength="15"
     10                 value="" tal:attributes="value view/reg_number"/>
     11      </td></tr>
     12      <tr>
     13        <td>
     14          <label for="ac_series">Access Code:
     15          </label></td> <td>
     16          <span tal:replace="view/ac_prefix">PIN Prefix
     17          </span> -
     18          <input name="ac_series" type="text" size="3" maxlength="3"
     19                 value="" tal:attributes="value view/ac_series"/> -
     20          <input name="ac_number" type="text" size="10" maxlength="10"
     21                 value="" tal:attributes="value view/ac_number" /> </td>
    1022      </tr>
    1123      <tr>
    12         <tr> <td>
    13             <label for="form.acseries">Access Code:
    14             </label></td> <td>
    15             <span tal:replace="view/acprefix">PIN Prefix
    16             </span> -
    17             <input name="form.acseries" type="text" size="3" maxlength="3"  value="" tal:attributes="value view/acseries"/> -
    18             <input name="form.acnumber" type="text" size="10" maxlength="10"  value="" tal:attributes="value view/acnumber" /> </td>
    19         </tr>
    20         <tr>
    21           <td colspan="2">
    22             <input type="submit" name="SUBMIT" value="Show Student Id and set password" /> </td>
    23         </tr>
     24        <td colspan="2">
     25        <input type="submit" name="SUBMIT"
     26               value="Show Student Id and set password" /> </td>
     27      </tr>
    2428    </tbody>
    2529  </table>
    2630</form>
    27 <div> <h3>Instructions:</h3>
     31<div><h3>Instructions:</h3>
    2832  <ul class="list">
    2933    <li> Acquire a password access code (PWD).
     
    3135    <li> Enter your (JAMB) registration number and the access code.
    3236    </li>
    33     <li> After pressing the button, your Student Id will be displayed and your password set.
    34         The 10-digit part of the access code just used is your new password.
     37    <li> After pressing the button, your Student Id will be displayed
     38    and your password set. The 10-digit part of the access code just
     39    used is your new password.
    3540    </li>
    36     <li> Go to the <strong><a href="login">general login page</a></strong> and enter your new credentials.
     41    <li> Go to the <strong><a href="login">general login
     42    page</a></strong> and enter your new credentials.
    3743    </li>
    3844  </ul>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6756 r6758  
    311311        student_path = 'http://localhost/app/students/%s' % test_student_id
    312312        self.browser.open(setpassword_path)
    313         self.browser.getControl(name="form.acseries").value = self.existing_series
    314         self.browser.getControl(name="form.acnumber").value = self.existing_number
    315         self.browser.getControl(name="form.reg_number").value = '123456'
     313        self.browser.getControl(name="ac_series").value = self.existing_series
     314        self.browser.getControl(name="ac_number").value = self.existing_number
     315        self.browser.getControl(name="reg_number").value = '123456'
    316316        self.browser.getControl("Show").click()
    317317        self.assertMatches('...Password has been set. Your Student Id is...',
     
    320320        self.browser.open(self.login_path)
    321321        self.browser.getControl(name="form.login").value = test_student_id
    322         self.browser.getControl(name="form.password").value = self.existing_number
     322        self.browser.getControl(
     323            name="form.password").value = self.existing_number
    323324        self.browser.getControl("Login").click()
    324325        self.assertEqual(self.browser.url, student_path)
Note: See TracChangeset for help on using the changeset viewer.