def enviat():
    """confirma i envia el email per canviar password"""
    form = emailForm()
    if request.method == 'POST':
        if form.validate() == False:
            return render_template('f_password.html', form=form)
        else:
            correu = request.form['email']
            user = A_GE_CAR_PERSONA.query.filter_by(e_mail=correu).first()
            token = generate_confirmation_token(correu)
            confirm_url = url_for('confirm_email', token=token, _external=True)
            html = render_template('canvi_pass.html', confirm_url=confirm_url)
            sender = ['*****@*****.**', user.e_mail]
            msg = Message('Restablir Password', sender=sender[0], recipients=sender)
            msg.html = html
            mail.send(msg)
            return redirect(url_for('enviat'))
    elif request.method == 'GET':
        return render_template('enviat.html', form=form)
def f_password():
    """formulari on s'ha d'enviar el correu de canvi de password"""
    form = emailForm()
    return render_template('f_password.html', form=form)
Exemplo n.º 3
0
def contact():
    form = emailForm()
    if form.validate_on_submit():
        flash('Email Sent to the administration team')
        return render_template('contact.html', title='Contact', form=form)
    return render_template('contact.html', title='Contact', form=form)