Exemple #1
0
def forgotten_password():

    form = ResetForgottenPassword()

    if UserSession.get_login_token():
        return redirect(url_for("blogs_app.blog"))
    elif form.validate_on_submit():

        user = User.get_account_by_email(form.email.data)

        if user:
            user.send_forgotten_password_code()
        return redirect(url_for('password_app.reset_password_msg'))
    return render_template('password/forgotten_password.html', form=form)
Exemple #2
0
 def validate_email(form, field):
     """"""
     if User.get_account_by_email(form.email.data):
         raise ValidationError('The email is already in use')