Changeset 1467 for WAeUP_SRP/trunk/skins


Ignore:
Timestamp:
22 Feb 2007, 10:48:52 (18 years ago)
Author:
joachim
Message:

add change password functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/change_password.py

    r1461 r1467  
    77request = context.REQUEST
    88import DateTime,logging
    9 
     9try:
     10    from Products.zdb import set_trace
     11except:
     12    def set_trace():
     13        pass
     14   
    1015current = DateTime.DateTime()
    1116#pr = context.portal_registration
     
    1419students_dir = context.portal_directories.students
    1520lt = context.portal_layouts
     21wt = context.waeup_tool
     22student_id = context.getStudentId()
    1623res,psm,ds = lt.renderLayout(layout_id= 'student_change_password',
    1724                      schema_id= 'student_change_password',
     
    3441    psm = "Please correct your input!"
    3542    return context.change_password_form(rendered = res,
    36                                  psm = None,
     43                                 psm = psm,
    3744                                 ds = ds,
    3845                                 mode = "edit",
     
    4148                                 )
    4249else:
    43     student_id = context.getStudentId()
    44     old_password = request.get('widget__old_password')
    45     password = request.get('widget__password')
    46     entry = students_dir.getEntry
    47     context.portal_membership.setPassword(password)
    48     psm = "Your Password has been changed"
     50    pass
     51old_password = request.get('widget__old_password')
     52if not wt.checkPassword(student_id,old_password):
     53    psm = "Old Password is not correct"
    4954    return context.change_password_form(rendered = res,
    50                                  psm = None,
    51                                  ds = ds,
    52                                  mode = "edit",
    53                                  formaction = "change_password",
    54                                  button = "Change Password",
    55                                  )
     55                             psm = psm,
     56                             ds = ds,
     57                             mode = "edit",
     58                             formaction = "change_password",
     59                             button = "Change Password",
     60                             )
     61#set_trace()
     62password = request.get('widget__password')
     63wt.editPassword(student_id,password)
     64args = {}
     65args['__ac_name'] = student_id
     66args['__ac_password'] = password
     67from urllib import urlencode
     68url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
     69return request.RESPONSE.redirect(url)
Note: See TracChangeset for help on using the changeset viewer.