source: WAeUP_SRP/trunk/skins/waeup_student/change_password.py @ 1474

Last change on this file since 1474 was 1474, checked in by Henrik Bettermann, 18 years ago

fixes

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1##parameters=
2# $Id: change_password.py 1474 2007-02-23 08:47:29Z henrik $
3"""
4process the Application Form
5return html renderer + psm
6"""
7request = context.REQUEST
8import DateTime,logging
9try:
10    from Products.zdb import set_trace
11except:
12    def set_trace():
13        pass
14
15current = DateTime.DateTime()
16#pr = context.portal_registration
17logger = logging.getLogger('Student.change_password')
18validate = request.has_key("change_password")
19students_dir = context.portal_directories.students
20lt = context.portal_layouts
21wt = context.waeup_tool
22student_id = context.getStudentId()
23res,psm,ds = lt.renderLayout(layout_id= 'student_change_password',
24                      schema_id= 'student_change_password',
25                      context=context,
26                      mapping=validate and request,
27                      ob = {},
28                      layout_mode='edit',
29                      button = "Change Password",
30                      commit = False,
31                      )
32if psm == '':
33    return context.change_password_form(rendered = res,
34                                 psm = None,
35                                 ds = ds,
36                                 mode = "edit",
37                                 formaction = "change_password",
38                                 button = "Change Password",
39                                 )
40elif psm == 'invalid':
41    psm = "Please correct your input!"
42    return context.change_password_form(rendered = res,
43                                 psm = psm,
44                                 ds = ds,
45                                 mode = "edit",
46                                 formaction = "change_password",
47                                 button = "Change Password",
48                                 )
49else:
50    pass
51old_password = request.get('widget__old_password')
52if not wt.checkPassword(student_id,old_password):
53    psm = "Old Password is not correct"
54    return context.change_password_form(rendered = res,
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 TracBrowser for help on using the repository browser.