本文整理汇总了Python中flask_login.current_user.generate_confirmation_token函数的典型用法代码示例。如果您正苦于以下问题:Python generate_confirmation_token函数的具体用法?Python generate_confirmation_token怎么用?Python generate_confirmation_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_confirmation_token函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
send_mail(current_user.email, 'Confirm your account',
'auth/email/confirm', user=current_user, token=token)
flash('A new confirmation email has been sent to {}.'.format(current_user.email))
current_app.logger.info("A new confirmation email has been sent to {}.".format(current_user.email))
return redirect(url_for('front_page.home_page'))
示例2: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
send_email(current_user.email, 'Confirm Your Account',
'auth/email/confirm', user = current_user, token=token)
flash('A new confirmation email has been sent to you by email.')
return redirect(url_for('main.index'))
示例3: retry_confirm
def retry_confirm():
if current_user.emailConfirmed:
flash('Your email address has been confirmed.', 'success')
return redirect(url_for('index'))
token = current_user.generate_confirmation_token()
message.send_email('Confirm Your Account', [current_user], 'confirmation', token=token)
flash('A new confirmation email has been sent to you. Please check your spam or junk folder.', 'info')
return redirect(url_for('index'))
示例4: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
rendered_content = render_template(
'auth/email/confirm.html', user=current_user, token=token)
send_email.delay(
current_user.email, u'确认注册'.encode('utf-8'), rendered_content)
flash(u'新的确认注册链接已经发送到你的邮箱')
return redirect(url_for('main.index'))
示例5: reconfirm
def reconfirm():
'''重新发送邮箱认证'''
if current_user.confirmed:
return redirect(url_for('main.index'))
else:
token = current_user.generate_confirmation_token()
send_email(current_user.email, u'注册账户邮箱认证', '/email/register.txt',
user=current_user, token=token)
flash(u'注册邮箱认证邮件已发送至您的邮箱,请前去邮箱完成注册')
return redirect(url_for('auth.login'))
示例6: resend_confirmation
def resend_confirmation():
'''
@note: 从新发送确认邮件
'''
token = current_user.generate_confirmation_token()
send_email(current_user.email, 'Confirm Your Account',
'auth/email/confirm', user=current_user, token=token)
flash('通过电子邮件发送了一封新的确认电子邮件.','info')
return redirect(url_for('main.index'))
示例7: resend_confirmation
def resend_confirmation():
if not current_user.confirmed:
token = current_user.generate_confirmation_token()
send_email(current_user.email,
"Confirm Your Account",
'auth/email/confirm',
user=current_user,
token=token)
flash("A new confirmation email has been sent")
return redirect(url_for('main.index'))
示例8: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
send_email(
to=current_user.email,
subject='Confirm your account',
template='auth/email/confirm',
user=current_user,
token=token
)
flash('A new confirmation email has been sent to your email account.')
return redirect(url_for('main.index'))
示例9: change_email_request
def change_email_request():
form = ChangeEmailForm()
if form.validate_on_submit():
new_email = form.email.data
current_user.verify_password(form.password.data)
token = current_user.generate_confirmation_token()
send_email(new_email, "Confirm Your Account", "auth/email/change_email", user=current_user, token=token)
flash("An email with instructions has been sent")
return redirect(url_for("main.index"))
else:
flash("Invalid password")
return render_template("auth/change_email.html", form=form)
示例10: change_email_request
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_confirmation_token(new_email)
send_email(new_email, '确认你的邮箱地址' \
'auth/email/change_email', \
user=current_user, token=token)
flash('用于更改并确认新邮箱的邮件已发送至你的新邮箱。')
return redirect(url_for('main.index'))
else:
flash('邮箱或密码不正确。')
return render_template('auth/change_email.html', form=form)
示例11: confirm_request
def confirm_request():
"""Respond to new user's request to confirm their account."""
token = current_user.generate_confirmation_token()
confirm_link = url_for('account.confirm', token=token, _external=True)
get_queue().enqueue(
send_email,
recipient=current_user.email,
subject='Confirm Your Account',
template='account/email/confirm',
# current_user is a LocalProxy, we want the underlying user object
user=current_user._get_current_object(),
confirm_link=confirm_link)
flash('A new confirmation link has been sent to {}.'.format(
current_user.email), 'warning')
return redirect(url_for('main.index'))
示例12: resend_confirmation
def resend_confirmation():
'''auth.resend_confirmation()'''
token = current_user.generate_confirmation_token()
send_email(
recipient=current_user.email,
subject='确认您的邮箱账户',
template='auth/mail/confirm',
user=current_user._get_current_object(),
token=token
)
flash('一封新的确认邮件已经发送至您的邮箱', category='info')
add_user_log(
user=current_user._get_current_object(),
event='请求重发邮箱确认邮件至:{}'.format(current_user.email),
category='auth'
)
return redirect(url_for('auth.unconfirmed'))
示例13: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
send_email(current_user.email, "Confirm Your Account", "/email/cnf", token=token)
flash("Письмо с подтверждением высланно повторно.")
return redirect("/events")
示例14: resend_confirmation
def resend_confirmation():
token = current_user.generate_confirmation_token()
send_email(current_user.email, u'确认账户',
'auth/email/confirm', user=current_user, token=token)
flash('一封确认邮件已经发送到你的邮箱.', "success")
return redirect(url_for('main.index'))
示例15: decorated_function
def decorated_function(*args, **kwargs):
if not current_user.confirmed:
token = current_user.generate_confirmation_token()
send_email([current_user.email], token=token)
return render_template('auth/confirm_required.html')
return fn(*args, **kwargs)