mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 10:58:58 -04:00
Refactored the forms so that fields like email_address can be used in multiple forms. Refactored form validation so that a query function is passed into the form to be run, this way the form is not exposed to the dao layer and the query is more efficient. This PR still requires some frontend attention. Will work with Chris to update the templates.
16 lines
584 B
Python
16 lines
584 B
Python
from flask import render_template, flash
|
|
from app.main import main
|
|
from app.main.dao import users_dao
|
|
from app.main.forms import ForgotPasswordForm
|
|
from app.main.views import send_change_password_email
|
|
|
|
|
|
@main.route('/forgot-password', methods=['GET', 'POST'])
|
|
def forgot_password():
|
|
form = ForgotPasswordForm(users_dao.get_user_by_email)
|
|
if form.validate_on_submit():
|
|
send_change_password_email(form.email_address.data)
|
|
return render_template('views/password-reset-sent.html')
|
|
else:
|
|
return render_template('views/forgot-password.html', form=form)
|