forgotpw.py
Go to the documentation of this file.
00001 #!/usr/bin/env python 
00002 
00003 import nstart
00004 import config
00005 import sys
00006 from pyclearsilver.CSPage import Context
00007 from MBPage import MBPage
00008 
00009 import MinibooMailbox
00010 
00011 class IndexPage(MBPage):
00012     def display(self):
00013         hdf = self.ncgi.hdf
00014 
00015         if hdf.getValue("Query.st","") == "3":
00016             self.handle_stage_3()
00017 
00018     def handle_stage_3(self):
00019         hdf = self.ncgi.hdf
00020         self.pagename = "forgotpw_3"
00021 
00022         q_login = hdf.getValue("Query.login","")
00023 
00024         hdf.setValue("CGI.Login",q_login)
00025 
00026     def Action_ResetPw(self):
00027         hdf = self.ncgi.hdf
00028         q_login = hdf.getValue("Query.login","")
00029         if q_login:
00030             self.redirectUri("forgotpw.py?st=3&login=%s" % q_login)
00031 
00032     def Action_SetPassword(self):
00033         hdf = self.ncgi.hdf
00034         q_login = hdf.getValue("Query.login","")
00035         q_pw1 = hdf.getValue("Query.pw1","")
00036         q_pw2 = hdf.getValue("Query.pw2","")
00037 
00038         if not q_login:
00039             self.redirectUri("forgotpw.py?q=1")
00040 
00041         if not q_pw1 or (q_pw1 != q_pw2):
00042             self.redirectUri("forgotpw.py?st=3&login=%s&err=pwdontmatch" % q_login)
00043 
00044         MB = MinibooMailbox.loadMailbox(q_login)
00045         MB.setPassword(q_pw1)
00046         self.MB = MB
00047         self.issueLoginCookie(q_login,self.registrydb.getOption("pw_hash"))
00048         self.redirectUri(config.gBaseURL + q_login + "/mail/index.py")
00049         
00050 
00051 def run(context):
00052   return IndexPage(context, pagename="forgotpw_1",nologin=1)
00053 
00054 def main(context):
00055   run(context).start()
00056 
00057 if __name__ == "__main__":
00058     main(Context())


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:00