Index: WAeUP_SRP/trunk/skins/waeup_student/change_password.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/change_password.py	(revision 1466)
+++ WAeUP_SRP/trunk/skins/waeup_student/change_password.py	(revision 1467)
@@ -7,5 +7,10 @@
 request = context.REQUEST
 import DateTime,logging
-
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+    
 current = DateTime.DateTime()
 #pr = context.portal_registration
@@ -14,4 +19,6 @@
 students_dir = context.portal_directories.students
 lt = context.portal_layouts
+wt = context.waeup_tool
+student_id = context.getStudentId()
 res,psm,ds = lt.renderLayout(layout_id= 'student_change_password',
                       schema_id= 'student_change_password',
@@ -34,5 +41,5 @@
     psm = "Please correct your input!"
     return context.change_password_form(rendered = res,
-                                 psm = None,
+                                 psm = psm,
                                  ds = ds,
                                  mode = "edit",
@@ -41,15 +48,22 @@
                                  )
 else:
-    student_id = context.getStudentId()
-    old_password = request.get('widget__old_password')
-    password = request.get('widget__password')
-    entry = students_dir.getEntry
-    context.portal_membership.setPassword(password)
-    psm = "Your Password has been changed"
+    pass
+old_password = request.get('widget__old_password')
+if not wt.checkPassword(student_id,old_password):
+    psm = "Old Password is not correct"
     return context.change_password_form(rendered = res,
-                                 psm = None,
-                                 ds = ds,
-                                 mode = "edit",
-                                 formaction = "change_password",
-                                 button = "Change Password",
-                                 )
+                             psm = psm,
+                             ds = ds,
+                             mode = "edit",
+                             formaction = "change_password",
+                             button = "Change Password",
+                             )
+#set_trace()
+password = request.get('widget__password')
+wt.editPassword(student_id,password)
+args = {}
+args['__ac_name'] = student_id
+args['__ac_password'] = password
+from urllib import urlencode
+url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
+return request.RESPONSE.redirect(url)
