示例#1
0
文件: views.py 项目: Forec/learn
def change_email():
	form = ChangeEmailForm()
	if form.validate_on_submit():
		token = current_user.generate_change_email_token(new_email = form.New_email.data)
		send_email(form.New_email.data,'Confirm your new email','auth/change/change_email',user=current_user,token=token)
		flash('A confirmation email has been sent to your new email. Please confirm that mail to change your email address.')
		return redirect(url_for('main.index'))
	return render_template('auth/change/change_email_index.html', form = form)
示例#2
0
文件: views.py 项目: khalily/myblog
def change_email_request():
    form = ChangeEmail()
    if form.validate_on_submit():
        token = current_user.generate_change_email_token()
        send_email(form.new_email.data, 'change email', 'email/change_email',
                   token=token, user=current_user)
        flash('an email send to your new email of change email.')
        return redirect(url_for('main.index'))
    return render_template('auth/change_email.html', form=form)
示例#3
0
文件: views.py 项目: yelongyu/chihu
def change_email():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(form.email.data)
            send_mail(form.email.data, '修改邮箱确认', 'auth/email/change_email_confirm', user=current_user, token=token)
            flash('确认邮件已发送到该新邮箱,请登录新邮箱进行验证。')
        else:
            flash('密码错误,请重新输入!')
    return render_template('auth/change_email.html', form=form)
示例#4
0
文件: views.py 项目: symyself/blog
def change_email_request():
    form = user_forms.change_email_form()
    if form.validate_on_submit():#已在form中对旧密码进行验证
        token = current_user.generate_change_email_token(new_email=form.new_email.data)
        send_email( form.new_email.data,'CHANGE YOUR EMAIL',
                'auth/email/change_email',user=current_user,token=token)
        flash('A email has been sent to your new email addr:'+form.new_email.data)
        return redirect( url_for( 'main.base'))
    else:
        return render_template('auth/change_email.html',form=form)
示例#5
0
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(new_email=form.new_email.data)
            send_email(form.email.data,'change your email address','auth/email/change_email',token=token,user=current_user)
            flash('we have sent a mail to you.')
            return redirect(url_for('main.index'))
        else:
            flash('Invalid email or password.')
    return render_template('auth/change_email.html',form=form)
示例#6
0
文件: views.py 项目: fengyc/flasky
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_change_email_token(new_email=new_email)
            send_mail(current_user.email, "Change Email", "auth/email/change_email", user=current_user, token=token)
            flash("An email with instructions to confirm email address has been sent to you.")
        else:
            flash("Invalid email or password.")
    return render_template("auth/change_email.html", form=form)
示例#7
0
文件: views.py 项目: Rain1996/Rblog
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(form.new_email.data)
            send_email(form.new_email.data, 'Change Your Email',
                'auth/email/change_email', user = current_user, token = token)
            flash('A confirmation email has been sent to your new email.')
            return redirect(url_for('main.index'))
        else:
            flash("Invalid email or password!")
    return render_template('auth/change_email.html', form = form)
示例#8
0
def change_email_request():
    ''' 用户输入新邮件地址,并发送一封确认邮件'''
    form = EmailResetForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(form.email.data)
            send_email(form.email.data, '验证您的新邮箱','auth/email/change_email', user = current_user, token = token)
            flash('一封确认邮件已经发送到了您的新邮箱')
        else:
            flash('密码不正确')
        return redirect(url_for('auth.change_email_request'))
    return render_template('auth/change_email.html', form = form)
示例#9
0
文件: views.py 项目: yuanniufei/blogs
def change_email_request():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.new_email.data
            token = current_user.generate_change_email_token(new_email)
            send_email(new_email,'确认邮箱',
                       'auth/email/change_email',token=token)
            flash('确认邮件已发到您的新邮箱')
            return redirect(url_for('main.index'))
        else:
            flash('邮箱或密码错误')
    return render_template('auth/change_email.html',form=form)
示例#10
0
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_change_email_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
0
文件: views.py 项目: yelongyu/chihu
def change_email():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(form.email.data)
            send_mail(form.email.data,
                      '修改邮箱确认',
                      'auth/email/change_email_confirm',
                      user=current_user,
                      token=token)
            flash('确认邮件已发送到该新邮箱,请登录新邮箱进行验证。')
        else:
            flash('密码错误,请重新输入!')
    return render_template('auth/change_email.html', form=form)
示例#12
0
def change_email():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        token = current_user.generate_change_email_token(
            new_email=form.New_email.data)
        send_email(form.New_email.data,
                   'Confirm your new email',
                   'auth/change/change_email',
                   user=current_user,
                   token=token)
        flash(
            'A confirmation email has been sent to your new email. Please confirm that mail to change your email address.'
        )
        return redirect(url_for('main.index'))
    return render_template('auth/change/change_email_index.html', form=form)
示例#13
0
def changeEmail():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_change_email_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)
示例#14
0
def change_email_request():
    form = user_forms.change_email_form()
    if form.validate_on_submit():  #已在form中对旧密码进行验证
        token = current_user.generate_change_email_token(
            new_email=form.new_email.data)
        send_email(form.new_email.data,
                   'CHANGE YOUR EMAIL',
                   'auth/email/change_email',
                   user=current_user,
                   token=token)
        flash('A email has been sent to your new email addr:' +
              form.new_email.data)
        return redirect(url_for('main.base'))
    else:
        return render_template('auth/change_email.html', form=form)
示例#15
0
文件: views.py 项目: kefatong/ops
def change_email_request():
    if current_user.is_anonymous:
        return redirect(url_for('main.index'))

    form = ChangeEmailRequestForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_change_email_token(new_email)
            send_email(new_email,'Change-Email','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)
示例#16
0
def change_email_request():
    ''' 用户输入新邮件地址,并发送一封确认邮件'''
    form = EmailResetForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            token = current_user.generate_change_email_token(form.email.data)
            send_email(form.email.data,
                       '验证您的新邮箱',
                       'auth/email/change_email',
                       user=current_user,
                       token=token)
            flash('一封确认邮件已经发送到了您的新邮箱')
        else:
            flash('密码不正确')
        return redirect(url_for('auth.change_email_request'))
    return render_template('auth/change_email.html', form=form)
示例#17
0
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_change_email_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)
示例#18
0
def changeEmail():
    form = ChangeEmailForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_change_email_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)
示例#19
0
文件: views.py 项目: kefatong/ops
def change_email_request():
    if current_user.is_anonymous:
        return redirect(url_for('main.index'))

    form = ChangeEmailRequestForm()
    if form.validate_on_submit():
        if current_user.verify_password(form.password.data):
            new_email = form.email.data
            token = current_user.generate_change_email_token(new_email)
            send_email(new_email,
                       'Change-Email',
                       '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)