5 import os, sys, string, time
8 from MBPage
import MBPage
14 from auth
import db_auth
15 from auth
import cookieauth
22 hdf.setValue(
"CGI.cur.request", self.
requestURI)
27 self.
requestURI = hdf.getValue(
"Query.request",
"")
29 self.
requestURI = hdf.getValue(
"HTTP.Referer",
"")
32 hdf.setValue(
"CGI.cur.request", self.
requestURI)
36 self.redirectUri(
"changePassword.py?err=%s&request=%s" % (neo_cgi.urlEscape(msg), neo_cgi.urlEscape(self.
requestURI)))
41 q_pw0 = hdf.getValue(
"Query.pw0",
"")
43 q_pw1 = hdf.getValue(
"Query.pw1",
"")
44 q_pw2 = hdf.getValue(
"Query.pw2",
"")
47 requestURI = hdf.getValue(
"Query.request",
"%swebui" % config.gBaseURL)
50 requestURI = config.gBaseURL + self.login +
"/mail/prefs.py" 56 self.
error(
"Old password is not complete.")
58 if not q_pw1
or (q_pw1 != q_pw2):
59 self.
error(
"New passwords do not match.")
61 authdb = db_auth.initSchema()
62 userRec = authdb.users.lookup(self.login)
64 if not userRec.checkPassword(q_pw0):
65 self.
error(
"Old password is invalid.")
67 userRec.setPassword(q_pw1)
69 cookieauth.issueLoginCookie(self.ncgi, authdb, self.login, userRec.pw_hash)
78 return IndexPage(context, pagename=
"changePassword", checkActive=
False)
83 if __name__ ==
"__main__":
def Action_changePassword(self)