Changeset 6701 for main/waeup.sirp
- Timestamp:
- 9 Sep 2011, 16:29:19 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6699 r6701 339 339 @grok.action('Save') 340 340 def save(self, **data): 341 form = self.request.form 342 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 343 if form.has_key('password') and form['password']: 344 if form['password'] != form['control_password']: 345 self.flash('Passwords do not match.') 346 return 347 IUserAccount(self.context).setPassword(form['password']) 348 self.context.loggerInfo(ob_class, 'password changed') 341 349 changed_fields = self.applyData(self.context, **data) 342 350 changed_fields = changed_fields.values() 343 351 fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields) 344 352 self.context._p_changed = True 345 form = self.request.form346 353 if form.has_key('transition') and form['transition']: 347 354 transition_id = form['transition'] 348 355 self.wf_info.fireTransition(transition_id) 349 if form.has_key('password') and form['password']:350 IUserAccount(self.context).setPassword(form['password'])351 if fields_string:352 fields_string += ' + password'353 else:354 fields_string = 'password'355 356 self.flash('Form has been saved.') 356 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')357 357 if fields_string: 358 358 self.context.loggerInfo(ob_class, 'saved: % s' % fields_string) … … 554 554 @grok.action('Save') 555 555 def save(self, **data): 556 form = self.request.form 557 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 558 if form.has_key('password') and form['password']: 559 if form['password'] != form['control_password']: 560 self.flash('Passwords do not match.') 561 return 562 IUserAccount(self.context).setPassword(form['password']) 563 self.context.loggerInfo(ob_class, 'password changed') 556 564 changed_fields = self.applyData(self.context, **data) 557 565 changed_fields = changed_fields.values() 558 566 fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields) 559 567 self.context._p_changed = True 560 form = self.request.form561 if form.has_key('password') and form['password']:562 IUserAccount(self.context).setPassword(form['password'])563 if fields_string:564 fields_string += ' + password'565 else:566 fields_string = 'password'567 568 self.flash('Form has been saved.') 568 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')569 569 if fields_string: 570 570 self.context.loggerInfo(ob_class, 'saved: % s' % fields_string) -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/baseeditpage.pt
r6700 r6701 44 44 </td> 45 45 </tr> 46 <tr> 47 <td class="label"><label>Retype password:</label></td> 48 <td> 49 <input name="control_password" type="password" /> 50 </td> 51 </tr> 46 52 </tbody> 47 53 </table> -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/basemanagepage.pt
r6700 r6701 45 45 </tr> 46 46 <tr> 47 <td class="label"><label>Retype password:</label></td> 48 <td> 49 <input name="control_password" type="password" /> 50 </td> 51 </tr> 52 <tr> 47 53 <td class="label"><label>Registration Transition:</label></td> 48 54 <td> -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6699 r6701 207 207 self.browser.getControl(name="form.reg_number").value = '123' 208 208 self.browser.getControl(name="password").value = 'secret' 209 self.browser.getControl(name="control_password").value = 'secret' 209 210 self.browser.getControl("Save").click() 210 211 self.assertMatches('...Form has been saved...', 211 212 self.browser.contents) 212 #self.assertTrue('Form has been saved' in self.browser.contents)213 214 213 self.browser.open(self.student_path) 215 214 self.browser.getLink("Clearance Data").click() … … 266 265 self.browser.getLink("Change password").click() 267 266 self.browser.getControl(name="password").value = 'new_password' 267 self.browser.getControl(name="control_password").value = 'new_password' 268 268 self.browser.getControl("Save").click() 269 269 self.assertTrue('Form has been saved' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.