mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Merging conflict with two_factor.py
Fixed merge mistake with two_factor.py.
This commit is contained in:
@@ -10,14 +10,6 @@ from flask.ext.login import current_user
|
||||
from flask_login import login_required
|
||||
from app.main import main
|
||||
|
||||
from app.main.dao.users_dao import (
|
||||
verify_password,
|
||||
update_user,
|
||||
check_verify_code,
|
||||
is_email_unique,
|
||||
send_verify_code
|
||||
)
|
||||
|
||||
from app.main.forms import (
|
||||
ChangePasswordForm,
|
||||
ChangeNameForm,
|
||||
@@ -50,7 +42,7 @@ def user_profile_name():
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_user.name = form.new_name.data
|
||||
update_user(current_user)
|
||||
user_api_client.update_user(current_user)
|
||||
return redirect(url_for('.user_profile'))
|
||||
|
||||
return render_template(
|
||||
@@ -65,7 +57,7 @@ def user_profile_name():
|
||||
def user_profile_email():
|
||||
|
||||
def _is_email_unique(email):
|
||||
return is_email_unique(email)
|
||||
return user_api_client.is_email_unique(email)
|
||||
form = ChangeEmailForm(_is_email_unique,
|
||||
email_address=current_user.email_address)
|
||||
|
||||
@@ -84,7 +76,7 @@ def user_profile_email():
|
||||
def user_profile_email_authenticate():
|
||||
# Validate password for form
|
||||
def _check_password(pwd):
|
||||
return verify_password(current_user.id, pwd)
|
||||
return user_api_client.verify_password(current_user.id, pwd)
|
||||
form = ConfirmPasswordForm(_check_password)
|
||||
|
||||
if NEW_EMAIL not in session:
|
||||
@@ -92,7 +84,7 @@ def user_profile_email_authenticate():
|
||||
|
||||
if form.validate_on_submit():
|
||||
session[NEW_EMAIL_PASSWORD_CONFIRMED] = True
|
||||
send_verify_code(current_user.id, 'email', session[NEW_EMAIL])
|
||||
user_api_client.send_verify_code(current_user.id, 'email', session[NEW_EMAIL])
|
||||
return redirect(url_for('.user_profile_email_confirm'))
|
||||
|
||||
return render_template(
|
||||
@@ -109,7 +101,7 @@ def user_profile_email_confirm():
|
||||
|
||||
# Validate verify code for form
|
||||
def _check_code(cde):
|
||||
return check_verify_code(current_user.id, cde, 'email')
|
||||
return user_api_client.check_verify_code(current_user.id, cde, 'email')
|
||||
form = ConfirmEmailForm(_check_code)
|
||||
|
||||
if NEW_EMAIL_PASSWORD_CONFIRMED not in session:
|
||||
@@ -119,7 +111,7 @@ def user_profile_email_confirm():
|
||||
current_user.email_address = session[NEW_EMAIL]
|
||||
del session[NEW_EMAIL]
|
||||
del session[NEW_EMAIL_PASSWORD_CONFIRMED]
|
||||
update_user(current_user)
|
||||
user_api_client.update_user(current_user)
|
||||
return redirect(url_for('.user_profile'))
|
||||
|
||||
return render_template(
|
||||
@@ -152,7 +144,7 @@ def user_profile_mobile_number_authenticate():
|
||||
|
||||
# Validate password for form
|
||||
def _check_password(pwd):
|
||||
return verify_password(current_user.id, pwd)
|
||||
return user_api_client.verify_password(current_user.id, pwd)
|
||||
form = ConfirmPasswordForm(_check_password)
|
||||
|
||||
if NEW_MOBILE not in session:
|
||||
@@ -160,7 +152,7 @@ def user_profile_mobile_number_authenticate():
|
||||
|
||||
if form.validate_on_submit():
|
||||
session[NEW_MOBILE_PASSWORD_CONFIRMED] = True
|
||||
send_verify_code(current_user.id, 'sms', session[NEW_MOBILE])
|
||||
user_api_client.send_verify_code(current_user.id, 'sms', session[NEW_MOBILE])
|
||||
return redirect(url_for('.user_profile_mobile_number_confirm'))
|
||||
|
||||
return render_template(
|
||||
@@ -177,7 +169,7 @@ def user_profile_mobile_number_confirm():
|
||||
|
||||
# Validate verify code for form
|
||||
def _check_code(cde):
|
||||
return check_verify_code(current_user.id, cde, 'sms')
|
||||
return user_api_client.check_verify_code(current_user.id, cde, 'sms')
|
||||
|
||||
if NEW_MOBILE_PASSWORD_CONFIRMED not in session:
|
||||
return redirect(url_for('.user_profile_mobile_number'))
|
||||
@@ -188,7 +180,7 @@ def user_profile_mobile_number_confirm():
|
||||
current_user.mobile_number = session[NEW_MOBILE]
|
||||
del session[NEW_MOBILE]
|
||||
del session[NEW_MOBILE_PASSWORD_CONFIRMED]
|
||||
update_user(current_user)
|
||||
user_api_client.update_user(current_user)
|
||||
return redirect(url_for('.user_profile'))
|
||||
|
||||
return render_template(
|
||||
@@ -204,12 +196,12 @@ def user_profile_password():
|
||||
|
||||
# Validate password for form
|
||||
def _check_password(pwd):
|
||||
return verify_password(current_user.id, pwd)
|
||||
return user_api_client.verify_password(current_user.id, pwd)
|
||||
form = ChangePasswordForm(_check_password)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_user.set_password(form.new_password.data)
|
||||
update_user(current_user)
|
||||
user_api_client.update_user(current_user)
|
||||
return redirect(url_for('.user_profile'))
|
||||
|
||||
return render_template(
|
||||
|
||||
Reference in New Issue
Block a user