Esempio n. 1
0
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        token = generate_token(user=current_user, operation=Operations.CHANGE_EMAIL, new_email=form.email.data.lower())
        send_change_email_email(to=form.email.data, user=current_user, token=token)
        flash('Confirm email sent, check your inbox.', 'info')
        return redirect(url_for('.index', username=current_user.username))
    return render_template('user/settings/change_email.html', form=form)
Esempio n. 2
0
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        token = generate_token(current_user,
                               operation=Operations.CHANGE_EMAIL,
                               new_email=form.email.data)
        send_change_email_email(current_user, token=token, to=form.email.data)
        flash('确认邮件已发送到你的新邮箱,请注意查收。', 'success')
        return redirect(url_for('.change_email_request'))
    form.email.data = current_user.email
    return render_template('user/settings/change_email.html', form=form)