forgotpw.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import nstart
4 import config
5 import sys
6 from pyclearsilver.CSPage import Context
7 from MBPage import MBPage
8 
9 import MinibooMailbox
10 
11 class IndexPage(MBPage):
12  def display(self):
13  hdf = self.ncgi.hdf
14 
15  if hdf.getValue("Query.st","") == "3":
16  self.handle_stage_3()
17 
18  def handle_stage_3(self):
19  hdf = self.ncgi.hdf
20  self.pagename = "forgotpw_3"
21 
22  q_login = hdf.getValue("Query.login","")
23 
24  hdf.setValue("CGI.Login",q_login)
25 
26  def Action_ResetPw(self):
27  hdf = self.ncgi.hdf
28  q_login = hdf.getValue("Query.login","")
29  if q_login:
30  self.redirectUri("forgotpw.py?st=3&login=%s" % q_login)
31 
32  def Action_SetPassword(self):
33  hdf = self.ncgi.hdf
34  q_login = hdf.getValue("Query.login","")
35  q_pw1 = hdf.getValue("Query.pw1","")
36  q_pw2 = hdf.getValue("Query.pw2","")
37 
38  if not q_login:
39  self.redirectUri("forgotpw.py?q=1")
40 
41  if not q_pw1 or (q_pw1 != q_pw2):
42  self.redirectUri("forgotpw.py?st=3&login=%s&err=pwdontmatch" % q_login)
43 
44  MB = MinibooMailbox.loadMailbox(q_login)
45  MB.setPassword(q_pw1)
46  self.MB = MB
47  self.issueLoginCookie(q_login,self.registrydb.getOption("pw_hash"))
48  self.redirectUri(config.gBaseURL + q_login + "/mail/index.py")
49 
50 
51 def run(context):
52  return IndexPage(context, pagename="forgotpw_1",nologin=1)
53 
54 def main(context):
55  run(context).start()
56 
57 if __name__ == "__main__":
58  main(Context())


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24