当前位置: 首页>>代码示例>>Python>>正文


Python User.create_password方法代码示例

本文整理汇总了Python中model.User.create_password方法的典型用法代码示例。如果您正苦于以下问题:Python User.create_password方法的具体用法?Python User.create_password怎么用?Python User.create_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.User的用法示例。


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

示例1: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_password [as 别名]
 def post(self):
     opassword = self.get_argument("opassword", None)
     password = self.get_argument("password", None)
     apassword = self.get_argument("apassword", None)
     
     if opassword and password and apassword:
         if len(password) < 6:
             self.flash("请确认输入6位以上新密码")
         elif password != apassword:
                 self.flash("请确认新密码和重复密码一致")
         else:
             user = self.get_current_user()
             if user.check_password(opassword):
                 user.password = User.create_password(password)
                 user.save()
                 
                 self.flash("修改密码成功,请重新登陆。", 'ok')
                 self.redirect("/signout?next=/signin")
                 return
             else:
                 self.flash("请输入正确的老密码")
     else:
         self.flash("请输入老密码和新密码")
     
     self.render('user/password.html')
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:27,代码来源:user.py

示例2: syncdb

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_password [as 别名]
def syncdb():
    from lib.util import find_subclasses
    from model import db, User, Distribution, Category, Page
    
    models = find_subclasses(db.Model)
    for model in models:
        if model.table_exists():
            model.drop_table()
        model.create_table()
        logging.info('created table:%s' % model._meta.db_table)
    
    Distribution.create(name = '免费配送', price = 0)
    Distribution.create(name = '上门自提', price = 0)
    Category.create(name = '积分商品', slug = 'credit', order = 1)
    Category.create(name = '搭配购买', slug = 'acc', order = 2)
    Category.create(name = '慕斯蛋糕', slug = 'mousse', order = 3)
    Category.create(name = '巧克力蛋糕', slug = 'chocolate', order = 4)
    Category.create(name = '乳酪蛋糕', slug = 'cheese', order = 5)
    Category.create(name = '乳脂奶油蛋糕', slug = 'creambutter', order = 6)
    Category.create(name = '冰淇淋蛋糕', slug = 'icecream', order = 7)
    Page.create(name = '吉米的厨房', slug = 'aboutus', content = '')
    Page.create(name = '包装展示', slug = 'bzzs', content = '')
    Page.create(name = '订购说明', slug = 'dgsm', content = '')
    Page.create(name = '如何收货', slug = 'rhsh', content = '')
    Page.create(name = '付款方式', slug = 'fkfs', content = '')
    Page.create(name = '配送范围', slug = 'psfw', content = '')
    User.create(mobile = 'root', password = User.create_password('111111'), group = 9)
    
    logging.info('superuser - username:root password:111111')
开发者ID:UniqueLJH,项目名称:yinongShop,代码行数:31,代码来源:manager.py

示例3: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_password [as 别名]
    def post(self):
        #if self.get_current_user():
         #   self.redirect("/")
         #   return
        
        mobile = self.get_argument("mobile", None)
        password = self.get_argument("password", None)
        apassword = self.get_argument("apassword", None)
        vcode = self.get_argument("vcode", None)
        sharer = self.get_argument("sharer", None)
        realname=self.get_argument("realname",None) 
        
        user = User()
        user.mobile = mobile
	user.realname = realname
        user.password = User.create_password(password)
        
        try:
            user.validate()
            
            if password and apassword:
                if len(password) < 6:
                    self.flash("请确认输入6位以上新密码")
                elif password != apassword:
                    self.flash("请确认新密码和重复密码一致")
		elif len(realname) > 32:
		    self.flash("微信账号超出长度限制")
		elif len(realname) < 2:
		    self.flash("微信账号太短")
                else:
                    #if UserVcode.select().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).count() > 0:
                    #    UserVcode.delete().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).execute()
                        user.save()
       			user.updatesignin()
                        self.session['user'] = user
                 
                        if 'oauth' in self.session:
                            oauth = self.session['oauth']
                            o = Oauth()
                            o.uid = user.id
                            o.openid = oauth['id']
                            o.src = oauth['src']
                            o.save()
                            
                            del self.session['oauth']
                            self.session.save()
                        User.update(credit = User.credit + 1).where(User.mobile == mobile).execute()
                        #if sharer != None
                        User.update(credit = User.credit + 1).where(User.mobile == sharer).execute()
                        self.flash("注册成功,请先登录。", "ok")
                        url="/signup?sharer="+user.mobile
            		self.redirect(url,permanent=True)
			return
                    #else:
                    #    self.flash("请输入正确的验证码")
            else:
                self.flash("请输入密码和确认密码")
        except Exception, ex:
            self.flash(str(ex))
开发者ID:yanjinjin,项目名称:dz_csyp,代码行数:61,代码来源:site.py

示例4: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_password [as 别名]
    def post(self):
        if self.get_current_user():
            self.redirect("/")
            return
        
        mobile = self.get_argument("mobile", None)
        password = self.get_argument("password", None)
        apassword = self.get_argument("apassword", None)
        vcode = self.get_argument("vcode", None)
        sharer = self.get_argument("sharer", None)
        openid = self.get_argument("openid", None) 
        
        user = User()
        user.mobile = mobile
        user.openid = openid
        print openid
        user.password = User.create_password(password)
        
        try:
            user.validate()
            
            if password and apassword:
                if len(password) < 6:
                    self.flash("请确认输入6位以上新密码")
                elif password != apassword:
                    self.flash("请确认新密码和重复密码一致")
                else:
                    if UserVcode.select().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).count() > 0:
                        UserVcode.delete().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).execute()
                        user.save()
                        
                        if 'oauth' in self.session:
                            oauth = self.session['oauth']
                            o = Oauth()
                            o.uid = user.id
                            o.openid = oauth['id']
                            o.src = oauth['src']
                            o.save()
                            
                            del self.session['oauth']
                            self.session.save()
                        print sharer
			User.update(credit = User.credit + 1).where(User.mobile == mobile).execute()
                        #if sharer != None
                        User.update(credit = User.credit + 1).where(User.mobile == sharer).execute()
			self.flash("注册成功,请先登录。", "ok")
                        self.redirect("/signin")
                        return
                    else:
                        self.flash("请输入正确的验证码")
            else:
                self.flash("请输入密码和确认密码")
        except Exception, ex:
            self.flash(str(ex))
开发者ID:yanjinjin,项目名称:wxshop,代码行数:56,代码来源:site.py

示例5: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_password [as 别名]
 def post(self):
     if self.get_current_user():
         self.redirect("/")
         return
     
     mobile = self.get_argument("mobile", None)
     password = self.get_argument("password", None)
     apassword = self.get_argument("apassword", None)
     vcode = self.get_argument("vcode", None)
     
     try:
         user = User().get(mobile = mobile)
     except:
         self.flash("此用户不存在")
         self.redirect("/resetpassword")
         return
     
     try:
         if password and apassword:
             if len(password) < 6:
                 self.flash("请确认输入6位以上新密码")
             elif password != apassword:
                 self.flash("请确认新密码和重复密码一致")
             else:
                 if UserVcode.select().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).count() > 0:
                     UserVcode.delete().where((UserVcode.mobile == mobile) & (UserVcode.vcode == vcode)).execute()
                     user.password = User.create_password(password)
                     user.save()
                     self.flash("重置密码成功,请先登录。", "ok")
                     self.redirect("/signin")
                     return
                 else:
                     self.flash("请输入正确的验证码")
         else:
             self.flash("请输入密码和确认密码")
     except Exception as ex:
         self.flash(str(ex))
     
     self.render("site/resetpassword.html")
开发者ID:gislite,项目名称:cakeshop,代码行数:41,代码来源:site.py


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