Пример #1
0
        <script type="text/javascript">
            window.location.href = "/";
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='/'>link.</a>
    </body>
</html>
"""

cookie_hash = mew.getCookieHash(os.environ)

if (("userId" not in cookie_hash)
        or ("sessionId" not in cookie_hash) or (mew.authenticateSession(
            cookie_hash["userId"], cookie_hash["sessionId"]) == 0)):
    print "Location:/index"
    print
    sys.exit(0)

userId = cookie_hash["userId"]
sessionId = cookie_hash["sessionId"]
userData = mew.getUser(userId)
userName = userData["userName"]

r = mew.deactivateSession(userId, sessionId)

cookie = Cookie.SimpleCookie()
cookie["message"] = str(userName) + " logged out"

expiration = datetime.datetime.now() + datetime.timedelta(days=-1)
Пример #2
0
    obj = {
        "type": "id",
        "id": str(zip_uid),
        "notes": "zip project file",
        "name": json_message["name"]
    }
    return obj


userId = None
sessionId = None
projectId = None

fields = cgi.FieldStorage()
if ("userId" in fields) and ("sessionId" in fields):
    if mew.authenticateSession(fields["userId"].value,
                               fields["sessionId"].value):
        userId = fields["userId"].value
        sessionId = fields["sessionId"].value
        if "projectId" in fields:
            projectId = fields["projectId"].value
elif (("userId" in cookie_hash)
      and ("sessionId" in cookie_hash) and (mew.authenticateSession(
          cookie_hash["userId"], cookie_hash["sessionId"]) == 1)):
    userId = cookie_hash["userId"]
    sessionId = cookie_hash["sessionId"]
    if "projectId" in fields:
        projectId = fields["projectId"].value
elif "projectId" in fields:
    projectId = fields["projectId"].value

#log_line( "u: " + str(userId) )
Пример #3
0
import urllib
import Cookie
import meowaux as mew
cgitb.enable()

h = {}
form = cgi.FieldStorage()
for k in form:
    h[k] = form[k].value

cookie = Cookie.SimpleCookie()
cookie_hash = mew.getCookieHash(os.environ)

loggedInFlag = False
if (("userId" in cookie_hash)
        and ("sessionId" in cookie_hash) and (mew.authenticateSession(
            cookie_hash["userId"], cookie_hash["sessionId"]) == 1)):
    loggedInFlag = True

userId = None
if "userId" in cookie_hash:
    userId = cookie_hash["userId"]

msg, msgType = mew.processCookieMessage(cookie, cookie_hash)

template = mew.slurp_file("template/search.html")
nav = mew.slurp_file("template/navbar_template.html")
footer = mew.slurp_file("template/footer_template.html")
analytics = mew.slurp_file("template/analytics_template.html")

userData = {}
userId = None
Пример #4
0
  if typ == "badusername":
    cookie["signup_focus"] = "username"
  elif typ == "badpassword":
    cookie["signup_focus"] = "password"
  else:
    cookie["signup_focus"] = "username"

  print "Location:register"
  print cookie.output()
  print
  sys.exit(0)


loggedInFlag = False
if ( ("userId" in cookie_hash) and ("sessionId" in cookie_hash)  and
     (mew.authenticateSession( cookie_hash["userId"], cookie_hash["sessionId"] ) != 0) ):
  loggedInFlag = True

msg,msgType = mew.processCookieMessage( cookie, cookie_hash )

template = mew.slurp_file("template/register.html")

nav = mew.slurp_file("template/navbar_template.html")

if not loggedInFlag:
  nav = nav.replace("<!--NAVBAR_USER_CONTEXT-->", loginform )

footer = mew.slurp_file("template/footer_template.html")
analytics = mew.slurp_file("template/analytics_template.html")
clear_workspace = mew.slurp_file("template/register_anonymous_logout.html")