signin0.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import nstart
4 import config
5 import os, sys, string, time
6 
7 from pyclearsilver.log import *
8 
9 from pyclearsilver.CSPage import Context, CSPage
10 import neo_cgi
11 
12 from auth import cookieauth
13 from auth import pwauth
14 
15 import xss
16 
17 import MBPage
18 
20  def setup(self):
21  hdf = self.ncgi.hdf
22  self.requestURI = hdf.getValue("Query.request", "")
23 
24  def display(self):
25  hdf = self.ncgi.hdf
26  q_signout = hdf.getIntValue("Query.signout",0)
27  self.requestURI = hdf.getValue("Query.request", "")
28 
29  q_username = xss.xssescape(string.lower(hdf.getValue("Query.username","")))
30 
31  hdf.setValue("CGI.username", q_username)
32 
33  if self.requestURI:
34  hdf.setValue("CGI.cur.request", self.requestURI)
35 
36  if q_signout:
37  cookieauth.clearLoginCookie(self.ncgi, self.username)
38 
39  def Action_Login(self):
40  hdf = self.ncgi.hdf
41 
42  q_username = xss.xssescape(string.lower(hdf.getValue("Query.username","")))
43  q_password = hdf.getValue("Query.password","")
44  q_persist = hdf.getValue("Query.persist","0")
45 
46  q_password_Hash = pwauth.mungePassword(q_password)
47 
48  if not self.requestURI:
49  self.requestURI = config.gBaseURL + "%s/" % config.gDefaultModule
50 
51  hostname = hdf.getValue("HTTP.Host", "")
52 
53  # open login db to get pw
54  newhost = hostname
55 
56  cookieauth.setPersistCookie(self.ncgi, q_persist)
57 
58  url = self.http + newhost + config.gBaseURL + "login/signin.py?password=%s&persist=%s&Action.Login=1&request=%s&username=%s" % (neo_cgi.urlEscape(q_password_Hash), q_persist, neo_cgi.urlEscape(self.requestURI), q_username)
59  warn("signin0.py", "redirecting to url", url)
60  self.redirectUri(url)
61 
62 def run(context):
63  page = SignInPage(context, pagename="signin0", nologin=1)
64  return page
65 
66 def main(context):
67  page = run(context)
68  page.start()
69 
70 
71 if __name__ == "__main__":
72  main(Context())
def redirectUri(self, redirectTo)


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