mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Add endpoints for forgot-password.
This commit is contained in:
21
app/main/views/forgot_password.py
Normal file
21
app/main/views/forgot_password.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from flask import render_template, jsonify
|
||||
|
||||
from app.main import main
|
||||
from app.main.forms import ForgotPassword
|
||||
from app.main.views import send_change_password_email
|
||||
|
||||
|
||||
@main.route('/forgot-password', methods=['GET'])
|
||||
def render_forgot_my_password():
|
||||
return render_template('views/forgot-password.html', form=ForgotPassword())
|
||||
|
||||
|
||||
@main.route('/forgot-password', methods=['POST'])
|
||||
def change_password():
|
||||
form = ForgotPassword()
|
||||
if form.validate_on_submit():
|
||||
send_change_password_email(form.email_address)
|
||||
|
||||
return 'You have been sent an email with a link to change your password'
|
||||
else:
|
||||
return jsonify(form.errors), 400
|
||||
Reference in New Issue
Block a user