Changeset 15606 for main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
- Timestamp:
- 24 Sep 2019, 17:21:28 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r15422 r15606 364 364 self.request.principal.id] 365 365 rel_link = '/students/%s' % self.request.principal.id 366 if student.personal_data_expired: 367 rel_link = '/students/%s/edit_personal' % ( 368 self.request.principal.id) 369 self.flash( 370 _('Your personal data record is outdated. Please update.'), 371 type='warning') 366 if student.getParentsPassword(): 367 # Add logging message 368 student.writeLogMessage(self, 'Parents logged in') 369 # Replace role if parents have logged in 370 role_manager = IPrincipalRoleManager(student) 371 role_manager.removeRoleFromPrincipal( 372 'waeup.local.StudentRecordOwner', student.student_id) 373 notify(LocalRoleSetEvent( 374 student, 'waeup.local.StudentRecordOwner', 375 student.student_id, granted=False)) 376 role_manager.assignRoleToPrincipal( 377 'waeup.local.Parents', student.student_id) 378 notify(LocalRoleSetEvent( 379 student, 'waeup.local.Parents', 380 student.student_id, granted=True)) 381 else: 382 # Redirect to personal page if data are outdated 383 if student.personal_data_expired: 384 rel_link = '/students/%s/edit_personal' % ( 385 self.request.principal.id) 386 self.flash( 387 _('Your personal data record is outdated. Please update.'), 388 type='warning') 372 389 self.redirect(self.application_url() + rel_link) 373 390 return … … 402 419 return 403 420 # Display appropriate flash message if credentials are correct 404 # but student has been deactivated or a temporary password405 # has been set.421 # but student has been deactivated or a temporary or parents 422 # password has been set. 406 423 login = self.request.form['form.login'] 407 424 if len(login) == 8 and login in grok.getSite()['students']: … … 413 430 # The student entered valid credentials. 414 431 # First we check if a temporary password has been set. 415 delta = timedelta(minutes=10) 416 now = datetime.utcnow() 417 temp_password_dict = getattr(student, 'temp_password', None) 418 if temp_password_dict is not None and \ 419 now < temp_password_dict.get('timestamp', now) + delta: 432 if student.getTempPassword(): 420 433 self.flash( 421 434 _('Your account has been temporarily deactivated.'), 435 type='warning') 436 return 437 # Next we check if a parents password has been set. 438 if student.getParentsPassword(): 439 self.flash( 440 _('Your account has been temporarily deactivated ' 441 'because your parents have logged in.'), 422 442 type='warning') 423 443 return
Note: See TracChangeset for help on using the changeset viewer.