• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python user.make_secure_val函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中user.make_secure_val函数的典型用法代码示例。如果您正苦于以下问题:Python make_secure_val函数的具体用法?Python make_secure_val怎么用?Python make_secure_val使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了make_secure_val函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process_login

def process_login():

    connection = pymongo.Connection(connection_string, safe=True)

    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    print "user submitted ", username, "pass ", password

    userRecord = {}
    if (user.validate_login(connection, username, password, userRecord)):
        session_id = user.start_session(connection, username)
        if (session_id == -1):
            bottle.redirect("/internal_error")

        cookie = user.make_secure_val(session_id)

        # Warning, if you are running into a problem whereby the cookie being set here is 
        # not getting set on the redirct, you are probably using the experimental version of bottle (.12). 
        # revert to .11 to solve the problem.
        bottle.response.set_cookie("session", cookie)
        
        bottle.redirect("/welcome")

    else:
        return bottle.template("login", 
                           dict(username=cgi.escape(username), password="", 
                                login_error="Invalid Login"))
开发者ID:drozas,项目名称:mongodb,代码行数:28,代码来源:blog.py


示例2: process_signup

def process_signup():

    connection = pymongo.Connection(connection_string, safe=True)

    email = bottle.request.forms.get("email")
    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")
    verify = bottle.request.forms.get("verify")

    # set these up in case we have an error case
    errors = {'username':cgi.escape(username), 'email':cgi.escape(email)}
    if (user.validate_signup(username, password, verify, email, errors)):
        if (not user.newuser(connection, username, password, email)):
            # this was a duplicate
            errors['username_error'] = "Username already in use. Please choose another"
            return bottle.template("signup", errors)
            
        session_id = user.start_session(connection, username)
        print session_id
        cookie= user.make_secure_val(session_id)
        bottle.response.set_cookie("session",cookie)
        bottle.redirect("/welcome")
    else:
        print "user did not validate"
        return bottle.template("signup", errors)
开发者ID:drozas,项目名称:mongodb,代码行数:25,代码来源:blog.py


示例3: process_login

def process_login():

    connection = pymongo.Connection(connection_string, safe=True)

    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    userRecord = {}
    if user.validate_login(connection, username, password, userRecord):
        # looks good. start a new session
        session_id = user.start_session(connection, username)
        if session_id == -1:
            bottle.redirect("/internal_error")

        cookie = user.make_secure_val(session_id)
        # send the cookie back to the user
        bottle.response.set_cookie("session", cookie)

        # full round trip here.

        bottle.redirect("/welcome")

    else:
        # not a valid login
        return bottle.template("login", dict(username=cgi.escape(username), password="", login_error="Invalid Login"))
开发者ID:Cignite,项目名称:blog-bottle-mongodb,代码行数:25,代码来源:blog.py


示例4: process_signup

def process_signup():
    print('signup process')
    connection = MongoClient("localhost", 27017)

    email = bottle.request.forms.get("email").strip()
    username = bottle.request.forms.get("username").strip()
    password = bottle.request.forms.get("password").strip()
    verify = bottle.request.forms.get("verify").strip()
    
    print(email,username,password,verify)

    # set these up in case we have an error case
    errors = {'username': cgi.escape(username), 'email': cgi.escape(email)}
    print('er:', errors)
    if (user.validate_signup(username, password, verify, email, errors)):
        print('here1')
        if (not user.newuser(connection, username, password, email)):
            # this was a duplicate
            print('dup')
            errors['username_error'] = "Username already in use. Please choose another"
            return bottle.template("signup", errors)

        session_id = user.start_session(connection, username)
        print ('sessionid', session_id)
        cookie = user.make_secure_val(session_id)
        bottle.response.set_cookie("session", cookie)
        #cook = bottle.request.get_cookie('session')
        #print('cook', cook)
        #print('user', username)
        #username = bottle.request.forms.get("username")
        return bottle.template("welcome", username=username)
    else:
        print ("user did not validate")
        return bottle.template("signup", errors)
开发者ID:sumoward,项目名称:Tool,代码行数:34,代码来源:recap_questionaire_module.py


示例5: process_login

def process_login():

    connection = pymongo.Connection(connection_string, safe=True)

    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    print ("user submitted ", username, "pass ", password)

    userRecord = {}
    if (user.validate_login(connection, username, password, userRecord)):
        session_id = user.start_session(connection, username)
        if (session_id == -1):
            bottle.redirect("/internal_error")

        cookie = user.make_secure_val(session_id)

        
        bottle.response.set_cookie("session", cookie)
        
        bottle.redirect("/welcome")

    else:
        return bottle.template("login", 
                           dict(username=cgi.escape(username), password="", 
                                login_error="Invalid Login"))
开发者ID:sumoward,项目名称:Tool,代码行数:26,代码来源:account_management_module.py


示例6: process_login

def process_login():

    connection = pymongo.MongoClient(connection_string)

    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    print "user submitted ", username, "pass ", password

    userRecord = {}
    if (user.validate_login(connection, username, password, userRecord)):
        session_id = user.start_session(connection, username)
        if (session_id == -1):
            bottle.redirect("/internal_error")

        cookie = user.make_secure_val(session_id)

        # не работает с bottle .12, откатитесь на версию .11
        bottle.response.set_cookie("session", cookie)
        
        bottle.redirect("/")

    else:
        return bottle.template("login", 
                           dict(username=cgi.escape(username), password="", 
                                login_error="неверно"))
开发者ID:alexefremo,项目名称:diploma,代码行数:26,代码来源:site.py


示例7: process_signup

def process_signup():

    connection = pymongo.MongoClient(connection_string)
    
    email = bottle.request.forms.get("email")
    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")
    verify = bottle.request.forms.get("verify")

    # подготовоим объект, если вдруг у нас будут ошибки
    errors = {'username':cgi.escape(username), 'email':cgi.escape(email)}
    if (user.validate_signup(username, password, verify, email, errors)):
        if (not user.newuser(connection, username, password, email)):
            # дубликат
            errors['username_error'] = "Имя уже используется"
            return bottle.template("signup", errors)
            
        session_id = user.start_session(connection, username)
        print session_id
        cookie= user.make_secure_val(session_id)
        bottle.response.set_cookie("session",cookie)
        bottle.redirect("/")
    else:
        print "user did not validate"
        return bottle.template("signup", errors)
开发者ID:alexefremo,项目名称:diploma,代码行数:25,代码来源:site.py


示例8: process_login

def process_login():
    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")
    userRecord = {}
    if (user.validate_login(username, password, userRecord)):
        session_id = user.start_session(userRecord['uid'])
        cookie = user.make_secure_val(str(int(session_id)))
        bottle.response.set_cookie("session", cookie)

        bottle.redirect("/blog/welcome")

    else:
        return bottle.template("login", 
                           dict(username=cgi.escape(username), password="", 
                                login_error="Invalid Login"))
开发者ID:erlichson,项目名称:cs253,代码行数:15,代码来源:blog.py


示例9: process_signup

def process_signup():
    email = bottle.request.forms.get("email")
    username = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")
    verify = bottle.request.forms.get("verify")

    # set these up in case we have an error case
    errors = {'username':cgi.escape(username), 'email':cgi.escape(email)}
    if (user.validate_signup(username, password, verify, email, errors)):
        uid = user.newuser(username, password, email)
        if (uid == None):
            # this was a duplicate
            errors['username_error'] = "Username already in use. Please choose another"
            return bottle.template("signup", errors)
            
        session_id = user.start_session(uid)
        cookie= user.make_secure_val(str(int(session_id)))
        bottle.response.set_cookie("session",cookie)
        bottle.redirect("/blog/welcome")
    else:
        return bottle.template("signup", errors)
开发者ID:erlichson,项目名称:cs253,代码行数:21,代码来源:blog.py


示例10: signup

def signup():
    connection = pymongo.Connection(connection_string, safe=True)

    username = request.forms.get("username")
    password = request.forms.get("password")

    # set these up in case we have an error case
    errors = {'username_value': cgi.escape(username), 'username': ''}
    if user.validate_signup(username, password, errors):
        if not user.new_user(connection, username, password):
            # this was a duplicate
            errors['username_error'] = "Username already in use. Please choose another"
            return template("signup", errors)

        session_id = user.start_session(connection, username)
        print session_id
        cookie = user.make_secure_val(session_id)
        response.set_cookie("session", cookie)
        redirect("/main")
    else:
        print "user did not validate"
        return template("signup", errors)
开发者ID:chromebookbob,项目名称:python2012,代码行数:22,代码来源:routes.py


示例11: set_secure_cookie

	def set_secure_cookie(self, name, val):
		cookie_val = user.make_secure_val(val)
		self.response.headers.add_header(
			'Set-Cookie',
			'%s=%s; Path=/' % (name, cookie_val))
开发者ID:basslabb,项目名称:Wikiparser,代码行数:5,代码来源:basehandler.py



注:本文中的user.make_secure_val函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python user.signin函数代码示例发布时间:2022-05-27
下一篇:
Python user.logout函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap