本文整理汇总了Python中user.check_secure_val函数的典型用法代码示例。如果您正苦于以下问题:Python check_secure_val函数的具体用法?Python check_secure_val怎么用?Python check_secure_val使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_secure_val函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: process_logout
def process_logout():
connection = pymongo.Connection(connection_string, safe=True)
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print "no cookie..."
bottle.redirect("/signup")
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print "no secure session_id"
bottle.redirect("/signup")
else:
# remove the session
user.end_session(connection, session_id)
print "clearing the cookie"
bottle.response.set_cookie("session","")
bottle.redirect("/signup")
开发者ID:drozas,项目名称:mongodb,代码行数:28,代码来源:blog.py
示例2: present_welcome
def present_welcome():
# check for a cookie, if present, then extract value
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print "no cookie..."
bottle.redirect("/blog/signup")
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print "no secure session_id"
bottle.redirect("/blog/signup")
else:
# look up username record
session = user.get_session(session_id)
if (session == None):
print "no valid session"
bottle.redirect("/blog/signup")
username = user.uid_to_username(session['uid'])
if username == None:
print "Database error looking up uid"
bottle.redirect("/blog/signup")
return bottle.template("welcome", {'username':username})
开发者ID:erlichson,项目名称:cs253,代码行数:31,代码来源:blog.py
示例3: process_logout
def process_logout():
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print "no cookie..."
bottle.redirect("/blog/signup")
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print "no secure session_id"
bottle.redirect("/blog/signup")
else:
# remove the session
user.end_session(session_id)
print "clearing the cookie"
bottle.response.set_cookie("session",";Path=\/")
bottle.redirect("/blog/signup")
开发者ID:erlichson,项目名称:cs253,代码行数:25,代码来源:blog.py
示例4: process_logout
def process_logout():
connection = MongoClient("localhost", 27017)
cookie = bottle.request.get_cookie("session")
if (cookie is None):
print ("no cookie...")
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print ("no secure session_id")
else:
# remove the session
user.end_session(connection, session_id)
print ("clearing the cookie")
bottle.response.set_cookie("session", "")
bottle.redirect("/signup")
开发者ID:sumoward,项目名称:Tool,代码行数:15,代码来源:recap_questionaire_module.py
示例5: login_check
def login_check():
connection = MongoClient("localhost", 27017)
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print ("no cookie...")
return None
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print ("no secure session_id")
return None
else:
# look up username record
session = user.get_session(connection, session_id)
if (session == None):
return None
return session['username']
开发者ID:sumoward,项目名称:Tool,代码行数:17,代码来源:recap_questionaire_module.py
示例6: logout
def logout():
connection = pymongo.Connection(connection_string, safe=True)
cookie = request.get_cookie("session")
if cookie is None:
print "no cookie..."
redirect("/login")
else:
session_id = user.check_secure_val(cookie)
if session_id is None:
print "no secure session_id"
redirect("/login")
else:
# remove the session
user.end_session(connection, session_id)
print "clearing the cookie"
response.set_cookie("session", "")
redirect("/login")
开发者ID:chromebookbob,项目名称:python2012,代码行数:19,代码来源:routes.py
示例7: login_check
def login_check():
connection = pymongo.Connection(connection_string, safe=True)
cookie = request.get_cookie("session")
if cookie is None:
print "no cookie..."
return None
else:
session_id = user.check_secure_val(cookie)
if session_id is None:
print "no secure session_id"
return None
else:
# look up username record
session = user.get_session(connection, session_id)
if session is None:
return None
return session['username']
开发者ID:chromebookbob,项目名称:python2012,代码行数:21,代码来源:routes.py
示例8: login_check
def login_check():
connection = pymongo.Connection(connection_string, safe=True)
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print ("no cookie...")
return None
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print ("no secure session_id")
return None
else:
# look up username record
session = user.get_session(connection, session_id)
if (session == None):
return None
return session['username']
开发者ID:sumoward,项目名称:Tool,代码行数:22,代码来源:account_management_module.py
示例9: process_logout
def process_logout():
connection = pymongo.MongoClient(connection_string)
cookie = bottle.request.get_cookie("session")
if (cookie == None):
print "no cookie..."
bottle.redirect("/")
else:
session_id = user.check_secure_val(cookie)
if (session_id == None):
print "no secure session_id"
bottle.redirect("/")
else:
# удаляем сессию
user.end_session(connection, session_id)
print "clearing the cookie"
bottle.response.set_cookie("session","")
bottle.redirect("/")
开发者ID:alexefremo,项目名称:diploma,代码行数:22,代码来源:site.py
示例10: read_secure_cookie
def read_secure_cookie(self, name):
cookie_val = self.request.cookies.get(name)
return cookie_val and user.check_secure_val(cookie_val)
开发者ID:basslabb,项目名称:Wikiparser,代码行数:3,代码来源:basehandler.py
注:本文中的user.check_secure_val函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论