我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用flask_login.current_user.change_email()。
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)
def change_email(token): """Change email address using token. """ if current_user.change_email(token): flash('Your email address has been updated.') else: flash('Invalid request.') return redirect(url_for('.profile'))
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)
def change_email(token): if current_user.change_email(token): flash('Your email address has been updated.') else: flash('Invalid request.') return redirect(url_for('home.index'))
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)
def change_email(token): if current_user.change_email(token): flash(constant.EMAIL_UPDATE) else: flash(constant.UPDATE_FAIL) return redirect(url_for('auth.profile'))
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)
def change_email(token): if current_user.change_email(token): flash('Your email address has been updated.') else: flash('Invalid request.') return redirect(url_for('main.index'))
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)
def change_email(token): if current_user.change_email(token): flash('Your email address has been updated') else: flash('Invalid request') return redirect(url_for('main.index'))
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)
def change_email(token): if current_user.change_email(token): flash('?????????') else: flash('?????') return redirect(url_for('main.index'))