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


Python User.password方法代码示例

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


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

示例1: fake_users

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
def fake_users(session, request):
    u = User()
    u.username = 'test_user'
    u.password = 'test_password'
    session.add(u)
    session.commit()

    yield u
开发者ID:Teddy-Schmitz,项目名称:temperature_admin,代码行数:10,代码来源:conftest.py

示例2: setup

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
def setup():
    db.create_all(app=manager.app)
    with manager.app.app_context():
        u = User()
        u.username = 'admin'
        u.password = 'admin123'
        db.session.add(u)
        db.session.commit()
开发者ID:Teddy-Schmitz,项目名称:temperature_admin,代码行数:10,代码来源:run.py

示例3: create_user

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
def create_user():
    name = request.form.get('username', None)
    password = request.form.get('password', None)
    if all([name, password]):
        u = User()
        u.password = password
        u.username = name
        db.session.add(u)
        db.session.commit()
        return 'OK', 200
    return 'Error', 400
开发者ID:Teddy-Schmitz,项目名称:temperature_admin,代码行数:13,代码来源:views.py

示例4: test_users

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
def test_users(session):
    u = User()
    u.username = 'test_user'
    u.password = 'testpassword'

    session.add(u)
    session.commit()

    t = session.query(User).filter(User.username == 'test_user').first()

    assert t is not None
    assert u == t
    assert t.password == u.password
    assert t.api_key is None
开发者ID:Teddy-Schmitz,项目名称:temperature_admin,代码行数:16,代码来源:test_models.py

示例5: post

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
 def post(self):
   email = self.request.get('email')
   password = self.request.get('password')
   logging.info(email)
   logging.info(is_valid_email(email))
   if not is_valid_email(email):
     return self._result("INVALID_EMAIL")
   if not is_valid_password(password):
     return self._result("INVALID_PASSWORD")
   if email_exist(email):
     self._result("EMAIL_USED")
     return
   user = User()
   user.email = email
   user.nickname = self.request.get('nickname')
   user.password = hashlib.sha1(password).hexdigest()
   user.put()
   session = get_current_session()
   session['me'] = user
   self._result("SUCCESS")
开发者ID:gf2,项目名称:gf2,代码行数:22,代码来源:user.py

示例6: post

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
    def post(self):
        model = model_from_request(self.request, RegisterModel)

        # validate data; on error, redisplay form with error messages
        if not model.validate():
            self.view(model)
            return

        # save new user        
        user = User()
        user.username = model.user_name
        user.email = model.email
        # todo: hash password
        user.password = model.password

        user.put()

        # put him into session
        set_current_user(user)

        # redirect to the home page
        self.redirect("/")
开发者ID:randomdeveloper,项目名称:drinkdrankdrunk,代码行数:24,代码来源:register.py

示例7: post

# 需要导入模块: from models.users import User [as 别名]
# 或者: from models.users.User import password [as 别名]
    def post(self):
        twitter = Twitter.getInstance()
        model = model_from_request(self.request, RegisterModel)

        # validate data; on error, redisplay form with error messages
        if not model.validate():
            self.view(model)
            return

        # save new user
        user = User()
        user.username = model.twitter_name
        user.twitter = model.twitter_name
        user.email = ""
        pwd_hash = hashlib.md5()
        pwd_hash.update(model.password)
        user.password = pwd_hash.hexdigest()
        user.timezone = ""
        user.next_run_time = 0
        user.message_type = "reply"
        user.account_status = "enabled"
        user.repeat_times = 6
        user.followed_by = ""
        user.i_follow = ""
        user.messages_per_day = 10
        user.default_source_lang = "en"
        user.follow_lang_list = "en"
        user.total_points = 0

        user.put()
        try:
            twitter.api.CreateFriendship(model.twitter_name)
        except:
            pass
        # put him into session
        set_current_user(user)
        # redirect to the home page
        self.redirect("/profile")
开发者ID:dazbur,项目名称:languagebot,代码行数:40,代码来源:register.py


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