Python flask_login.current_user 模块,generate_email_change_token() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用flask_login.current_user.generate_email_change_token()

项目:myproject    作者:dengliangshi    | 项目源码 | 文件源码
def change_email_request():
    """Request for Changing email address.
    """
    form = ChangeEmailForm()
    if form.validate_on_submit():
        new_email = form.email.data
        token = current_user.generate_email_change_token(new_email)
        send_email(new_email, 'Confirm your email address',
                   'auth/email/change_email',
                   user=current_user, token=token)
        flash('An email with instructions to confirm your new email '
                  'address has been sent to you.')
        return redirect(url_for('.profile'))
    return render_template("auth/change_email.html", form=form)
项目:ButterSalt    作者:lfzyx    | 项目源码 | 文件源码
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_email_change_token(new_email)
            send_email(new_email, 'Confirm your email address',
                       'mail/user/change_email',
                       user=current_user, token=token)
            flash('An email with instructions to confirm your new email '
                  'address has been sent to you.')
            return redirect(url_for('home.index'))
        else:
            flash('Invalid password.')
    return render_template("user/change_email.html", form=form)
项目:zheye    作者:mathbugua    | 项目源码 | 文件源码
def profile():
    """??????"""
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_email_change_token(new_email)
            send_email(new_email, 'Confirm your email address',
                       'auth/email/change_email',
                       user=current_user, token=token)
            flash(constant.SEND_EMIAL)
            return redirect(url_for('auth.profile'))
        else:
            flash(constant.WRONG_PWD)
    return render_template("email_settings.html", user=current_user, form=form, base64=base64)
项目:LivroFlask    作者:antoniocsz    | 项目源码 | 文件源码
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_email_change_token(new_email)
            send_email(new_email, 'Confirm your email address',
                       'auth/email/change_email',
                       user=current_user, token=token)
            flash('An email with instructions to confirm your new email '
                  'address has been sent to you.')
        else:
            flash('Invalid email or password.')
    return render_template('auth/change_email.html', form=form)
项目:Ticlab    作者:St1even    | 项目源码 | 文件源码
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_email_change_token(new_email)
            send_email(new_email, 'Confirm your email address', 'auth/email/change_email', user = current_user, token = token)
            flash('An email with instructions to confirm your new email address has been sent to you')
            return redirect(url_for('main.index'))
        else:
            flash('Invalid email or password')
    return render_template('auth/change_email.html', form = form)
项目:Faiwong-s-blog    作者:Fai-Wong    | 项目源码 | 文件源码
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_email_change_token(new_email)
            send_email(new_email,'Confirm your email address', 
                    'auth/email/change_email', 
                    user=current_user, token=token)
            flash(u'??????????????????????')
            return redirect(url_for('main.index'))
        else:
            flash(u'?????????')
    return render_template('auth/change_email.html', form=form)