mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-02 17:48:50 -04:00
Add confirmation of password for important changes
This commit adds an extra page or field for confirming your current password when making important changes Name | Email address | Mobile number | Password ---------------------|-------------------|-------------------|------------ No password required | As second page | As second page | On same page as new password
This commit is contained in:
@@ -2,8 +2,8 @@ from flask import request, render_template, redirect, url_for
|
||||
from flask.ext.login import current_user
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
NewPasswordForm, ChangeNameForm, ChangeEmailForm, ConfirmEmailForm,
|
||||
ChangeMobileNumberForm, ConfirmMobileNumberForm
|
||||
ChangePasswordForm, ChangeNameForm, ChangeEmailForm, ConfirmEmailForm,
|
||||
ChangeMobileNumberForm, ConfirmMobileNumberForm, ConfirmPasswordForm
|
||||
)
|
||||
|
||||
|
||||
@@ -42,6 +42,22 @@ def userprofile_email():
|
||||
thing='email address',
|
||||
form_field=form.email_address
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.userprofile_email_authenticate'))
|
||||
|
||||
|
||||
@main.route("/user-profile/email/authenticate", methods=['GET', 'POST'])
|
||||
def userprofile_email_authenticate():
|
||||
|
||||
form = ConfirmPasswordForm()
|
||||
|
||||
if request.method == 'GET':
|
||||
return render_template(
|
||||
'views/user-profile/authenticate.html',
|
||||
thing='email address',
|
||||
form=form,
|
||||
back_link=url_for('.userprofile_email')
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.userprofile_email_confirm'))
|
||||
|
||||
@@ -74,6 +90,22 @@ def userprofile_mobile_number():
|
||||
thing='mobile number',
|
||||
form_field=form.mobile_number
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.userprofile_mobile_number_authenticate'))
|
||||
|
||||
|
||||
@main.route("/user-profile/mobile-number/authenticate", methods=['GET', 'POST'])
|
||||
def userprofile_mobile_number_authenticate():
|
||||
|
||||
form = ConfirmPasswordForm()
|
||||
|
||||
if request.method == 'GET':
|
||||
return render_template(
|
||||
'views/user-profile/authenticate.html',
|
||||
thing='mobile number',
|
||||
form=form,
|
||||
back_link=url_for('.userprofile_mobile_number_confirm')
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.userprofile_mobile_number_confirm'))
|
||||
|
||||
@@ -96,13 +128,12 @@ def userprofile_mobile_number_confirm():
|
||||
@main.route("/user-profile/password", methods=['GET', 'POST'])
|
||||
def userprofile_password():
|
||||
|
||||
form = NewPasswordForm()
|
||||
form = ChangePasswordForm()
|
||||
|
||||
if request.method == 'GET':
|
||||
return render_template(
|
||||
'views/user-profile/change.html',
|
||||
thing='password',
|
||||
form_field=form.new_password
|
||||
'views/user-profile/change-password.html',
|
||||
form=form
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.userprofile'))
|
||||
|
||||
Reference in New Issue
Block a user