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


Python Account.set_email_checked方法代码示例

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


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

示例1: register_valid

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import set_email_checked [as 别名]
def register_valid():
    code = request.args.get('code', '')
    expires_in=86400

    logging.debug("session:%s", session)

    if 'user' in session and session['user'].get('email'):
        mail = session['user'].get('email')
        #已经登录
        if session['user'].get('email_checked') == 1:
            return redirect(url_for('wx.wx_index'))

    if code and 'user' in session:
        account_obj = get_user(g._db)
        verify_email = Account.get_verify_email(g._db, code, EmailUsageType.SELLER_VERIFY)
        confirm = False
        if account_obj and \
           verify_email and \
           account_obj['id'] == verify_email['ro_id'] and \
           verify_email['ctime'] + expires_in > time.time():
            confirm = True

        Account.delete_verify_email(g._db, code, EmailUsageType.SELLER_VERIFY)
        if confirm:
            Account.set_email_checked(g._db, verify_email['ro_id'], 1)
            session['user']['email_checked'] = 1
            return redirect(url_for('wx.wx_index'))
        else:
            error = '确认邮件失败'
            logging.debug("error:%s %s %s %s", error, account_obj, verify_email, session['user'])
            return redirect(url_for('.login'))

    if 'user' in session and session['user'].get('email'):
        mail = session['user'].get('email')
        if session['user'].get('email_checked') == 1:
            return redirect(url_for('wx.wx_index'))
        else:
            url = get_email_url(mail)
            data={'mail': mail, 'redirect': url, 'error': ''}
            return render_template('user/register_valid.html', data=data)
    else:
        return redirect(url_for('.login'))
开发者ID:richmonkey,项目名称:xiaowei_web,代码行数:44,代码来源:account.py

示例2: register_valid

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import set_email_checked [as 别名]
def register_valid():
    code = request.args.get('code', '')
    error = ''
    expires_in=86400
    if code:
        if 'user' in session:
            account_obj = get_user(g._db)
            verify_email = Account.get_verify_email(g._db, code, EmailUsageType.DEVELOPER_VERIFY)
            logging.debug("verify email:%s", verify_email)
            confirm = False
            if verify_email and \
               verify_email['ctime'] + expires_in > time.time():
                confirm = True

            Account.delete_verify_email(g._db, code, EmailUsageType.DEVELOPER_VERIFY)
            if confirm:
                Account.set_email_checked(g._db, verify_email['ro_id'], 1)
                session['user']['email_checked'] = 1
                return redirect(url_for('store.store_index'))
            else:
                error = '确认邮件失败'

    if 'user' in session and session['user'].get('id'):
        update_session(g._db)

    if 'user' in session and session['user'].get('email'):
        mail = session['user'].get('email')
        if session['user'].get('email_checked') == 1:
            return redirect(url_for('store.store_index'))
    else:
        return redirect(url_for('.login'))

    if mail:
        suffix = mail.split('@')[1]
        suffix = suffix.lower()
        url = 'http://'
        if suffix == '163.com':
            url += 'mail.163.com'
        elif suffix == 'vip.163.com':
            url += 'vip.163.com'
        elif suffix == '126.com':
            url += 'mail.126.com'
        elif suffix == 'qq.com' or suffix == 'vip.qq.com' or suffix == 'foxmail.com':
            url += 'mail.qq.com'
        elif suffix == 'gmail.com':
            url += 'mail.google.com'
        elif suffix == 'sohu.com':
            url += 'mail.sohu.com'
        elif suffix == 'tom.com':
            url += 'mail.tom.com'
        elif suffix == 'vip.sina.com':
            url += 'vip.sina.com'
        elif suffix == 'sina.com.cn' or suffix == 'sina.com':
            url += 'mail.sina.com.cn'
        elif suffix == 'tom.com':
            url += 'mail.tom.com'
        elif suffix == 'yahoo.com.cn' or suffix == 'yahoo.cn':
            url += 'mail.cn.yahoo.com'
        elif suffix == 'tom.com':
            url += 'mail.tom.com'
        elif suffix == 'yeah.net':
            url += 'www.yeah.net'
        elif suffix == '21cn.com':
            url += 'mail.21cn.com'
        elif suffix == 'hotmail.com':
            url += 'www.hotmail.com'
        elif suffix == 'sogou.com':
            url += 'mail.sogou.com'
        elif suffix == '188.com':
            url += 'www.188.com'
        elif suffix == '139.com':
            url += 'mail.10086.cn'
        elif suffix == '189.cn':
            url += 'webmail15.189.cn/webmail'
        elif suffix == 'wo.com.cn':
            url += 'mail.wo.com.cn/smsmail'
        elif suffix == '139.com':
            url += 'mail.10086.cn'
        else:
            url = ''
    else:
        url = ''

    return render_template('user/register_valid.html', data={'mail': mail, 'redirect': url, 'error': error})
开发者ID:jzxyouok,项目名称:kefu_web,代码行数:86,代码来源:account.py


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