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


Python User.email方法代码示例

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


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

示例1: admin_users_add

# 需要导入模块: import User [as 别名]
# 或者: from User import email [as 别名]
def admin_users_add():
    user = User()
    user.id = ''
    user.firstname = ''
    user.lastname = ''
    user.email = ''
    return render_template('user.html', user=user)
开发者ID:smeggingsmegger,项目名称:flask-cookiecutter,代码行数:9,代码来源:admin.py

示例2: login

# 需要导入模块: import User [as 别名]
# 或者: from User import email [as 别名]
def login(provider_name):
    response = make_response()
    result = current_app.authomatic.login(
        WerkzeugAdapter(request, response), provider_name
    )

    if result:
        if result.user:
            first_login = False
            result.user.update()
            user = User.objects(provider=provider_name, user_id=result.user.id).first()
            if user is None:
                user = User(
                    username=result.user.username,
                    email=result.user.email,
                    name=result.user.name,
                    user_id=result.user.id,
                    provider=provider_name
                )
                user.save()
                first_login = True
            else:
                user.name = result.user.name
                user.email = result.user.email
                user.save()

            session['user_id'] = user.user_id
            return redirect_next()

        flash_error('Authentication failed')
        return redirect(url_for('auth.login_page', next=request.path))

    return response
开发者ID:scorphus,项目名称:generator-flask-app,代码行数:35,代码来源:_auth.py

示例3: new_user

# 需要导入模块: import User [as 别名]
# 或者: from User import email [as 别名]
def new_user(request):
    """Add a new user to the system manually."""
    rdict = request.params

    u = User()

    u.username = unicode(rdict.get('username'))
    u.email = unicode(rdict.get('email'))
    passwd = get_random_word(8)
    u.password = passwd
    u.activated = True
    u.is_admin = False
    u.api_key = User.gen_api_key()

    try:
        DBSession.add(u)
        DBSession.flush()
        # We need to return the password since the admin added the user
        # manually.  This is only time we should have/give the original
        # password.
        ret = dict(u)
        ret['random_pass'] = passwd
        return _api_response(request, ret)

    except IntegrityError, exc:
        # We might try to add a user that already exists.
        LOG.error(exc)
        request.response.status_int = 400
        return _api_response(request, {
            'error': 'Bad Request: User exists.',
        })
开发者ID:mazz,项目名称:kifu,代码行数:33,代码来源:api.py

示例4: register

# 需要导入模块: import User [as 别名]
# 或者: from User import email [as 别名]
def register():
    def check():
        email_exists = User.query.filter(db.func.lower(User.email) == form.email.data.lower()).first()
        if email_exists:
            flash('Пользователь с такой электронной почтой уже зарегистрирован.', 'danger')
            return False
        return True

    user = User()
    form = forms.RegisterForm(obj=user)

    if form.validate_on_submit() and check():
        if form.password.data != form.password2.data:
            flash('Введённые пароли не совпадают.')
        else:
            user.email = form.email.data
            user.name = form.name.data
            user.password_hash = User.hash_password(form.password.data)
            user.roles = 0

            db.session.add(user)
            db.session.commit()

            return render_template('users/after_register.html', email=user.email)

    flash_errors(form)

    return render_template('users/register.html', form=form)
开发者ID:uisky,项目名称:flask-fish,代码行数:30,代码来源:views.py


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