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


Python User.get_by_email方法代码示例

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


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

示例1: post

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
 def post(self):
     name = self.get_argument('name', '')
     email = self.get_argument('email', '')
     password = self.get_argument('password', '')
     if not name or len(name) > 15:
         self.render('join.html', error=111, name=name, email=email)
         return
     match = re.search(r'[\w.-][email protected][\w.-]+', email)
     if not match:
         self.render('join.html', error=112, name=name, email=email)
         return
     if not password:
         self.render('join.html', error=110, name=name, email=email)
         return
     user = User.get_by_email(email)
     if user:
         self.render('join.html', error=113, name=name, email=email)
         return
     user = User.new(name, email)
     if user:
         user.update_password(encrypt(password))
     else:
         self.render('join.html', error=114)
     self.set_secure_cookie('user', user.id, expires_days=30)
     self.redirect(self.get_argument('next', '/'))
开发者ID:Daniel7725,项目名称:diggit,代码行数:27,代码来源:login.py

示例2: post

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
    def post(self):
        username = self.get_argument('username', '')
        email = self.get_argument('email', '')
        password = self.get_argument('password', '')

        if not username or len(username) > 15:
            self.render('home/register.html', error=111, username=username, email=email)
            return
        match = re.search(r'[\w.-][email protected][\w.-]+', email)
        if not match:
            self.render('home/register.html', error=113, username=username, email=email)
            return
        if not password:
            self.render('home/register.html', error=110, username=username, email=email)
            return

        user = User.get_by_username(username)
        if user:
            self.render('home/register.html', error=112, username=username, email=email)
            return

        user = User.get_by_email(email)
        if user:
            self.render('home/register.html', error=114, username=username, email=email)
            return

        #走代理获取ip方式
        reg_ip = self.request.headers['X-Real-Ip']
        user = User.new(username, email, password, reg_ip)
        if user:
            self.set_secure_cookie('user_id', str(user.user_id), expires_days=30)
            self.redirect(self.get_argument('next', '/'))
        else:
            self.render('home/register.html', error=115)
开发者ID:ListFranz,项目名称:PyCMS-Tornado,代码行数:36,代码来源:login.py

示例3: update_attrs

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
def update_attrs(doc_id, **kwargs):
    #either replace the entire list or add a new entry to the list
    document = get_by_id(doc_id)
    build_suggestions = NAME in kwargs
    new_fields = {}

    new_fields[NAME] = kwargs.get(NAME, document.name)

    if not build_suggestions:
        new_fields[SUGGESTIONS] = document.suggestions
    else:
        new_fields['other_names'] =  _get_third_party_names(User.get_by_email(doc_id))
    _create(doc_id,**new_fields)
开发者ID:mschwalb,项目名称:photobout,代码行数:15,代码来源:user_document.py


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