Changeset 7149 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 20 Nov 2011, 06:49:24 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r7076 r7149 125 125 >>> browser.getLink("Add user").click() 126 126 >>> browser.getControl(name="form.name").value = 'bob' 127 >>> browser.getControl(name="form.password").value = 'secret' 127 >>> browser.getControl(name="password").value = 'secret' 128 >>> browser.getControl(name="control_password").value = 'secret' 128 129 >>> browser.getControl("Add user").click() 129 130 >>> print browser.contents … … 136 137 >>> browser.getControl("edit", index=0).click() 137 138 >>> browser.getControl("Save", index=0).click() 138 >>> browser.getControl("Save and return", index=0).click()139 >>> browser.getControl("edit", index=0).click()140 139 >>> browser.getControl("Cancel", index=0).click() 141 140 … … 159 158 >>> browser.open('http://localhost/myuniversity/users/add') 160 159 >>> browser.getControl(name="form.name").value = 'bob' 161 >>> browser.getControl(name="form.password").value = 'secret' 160 >>> browser.getControl(name="password").value = 'secret' 161 >>> browser.getControl(name="control_password").value = 'secret' 162 162 >>> browser.getControl("Add user").click() 163 163 >>> 'The userid chosen already exists' in browser.contents -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7137 r7149 35 35 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor, 36 36 ILocalRolesAssignable, DuplicationError, IConfigurationContainer, 37 ISessionConfiguration, ISessionConfigurationAdd, academic_sessions_vocab) 37 ISessionConfiguration, ISessionConfigurationAdd, academic_sessions_vocab, 38 IPasswordValidator) 38 39 from waeup.sirp.permissions import get_users_with_local_roles, getRoles 39 40 from waeup.sirp.university.catalog import search … … 285 286 grok.context(IUserContainer) 286 287 grok.name('add') 288 grok.template('usereditformpage') 287 289 form_fields = grok.AutoFields(IUserAccount) 288 290 label = 'Add user' … … 294 296 title = data['title'] 295 297 description = data['description'] 296 password = data['password']298 #password = data['password'] 297 299 roles = data['roles'] 300 form = self.request.form 301 password = form.get('password', None) 302 password_ctl = form.get('control_password', None) 303 if password: 304 validator = getUtility(IPasswordValidator) 305 errors = validator.validate_password(password, password_ctl) 306 if errors: 307 self.flash( ' '.join(errors)) 308 return 298 309 try: 299 310 self.context.addUser(name, password, title=title, … … 318 329 @grok.action('Save') 319 330 def save(self, **data): 331 form = self.request.form 332 password = form.get('password', None) 333 password_ctl = form.get('control_password', None) 334 if password: 335 validator = getUtility(IPasswordValidator) 336 errors = validator.validate_password(password, password_ctl) 337 if errors: 338 self.flash( ' '.join(errors)) 339 return 320 340 self.applyData(self.context, **data) 341 if password: 342 # Now we know that the form has no errors and can set password ... 343 self.context.setPassword(password) 321 344 self.flash('User settings have been saved.') 322 return323 324 @grok.action('Save and return')325 def saveAndReturn(self, **data):326 self.applyData(self.context, **data)327 self.flash('User settings have been saved.')328 self.redirect(self.url(self.context.__parent__))329 345 return 330 346 -
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r7147 r7149 188 188 title = u'Description', 189 189 required = False,) 190 password = schema.Password(191 title = u'Password',192 required = True,)193 190 roles = schema.List( 194 191 title = u'Global roles',
Note: See TracChangeset for help on using the changeset viewer.