mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Working tests, hopefully all code changes done.
This commit is contained in:
@@ -4,7 +4,8 @@ from flask import (
|
||||
render_template,
|
||||
redirect,
|
||||
session,
|
||||
abort
|
||||
abort,
|
||||
url_for
|
||||
)
|
||||
|
||||
from client.errors import HTTPError
|
||||
@@ -15,10 +16,6 @@ from app.main.forms import RegisterUserForm
|
||||
|
||||
from app import user_api_client
|
||||
|
||||
# TODO how do we handle duplicate unverifed email addresses?
|
||||
# malicious or otherwise.
|
||||
from app.notify_client.sender import send_sms_code, send_email_code
|
||||
|
||||
|
||||
@main.route('/register', methods=['GET', 'POST'])
|
||||
def register():
|
||||
@@ -41,10 +38,10 @@ def register():
|
||||
# How do we report to the user there is a problem with
|
||||
# sending codes apart from service unavailable?
|
||||
# at the moment i believe http 500 is fine.
|
||||
send_sms_code(user_id=user.id, mobile_number=user.mobile_number)
|
||||
send_email_code(user_id=user.id, email=user.email_address)
|
||||
users_dao.send_verify_code(user.id, 'sms')
|
||||
users_dao.send_verify_code(user.id, 'email')
|
||||
session['expiry_date'] = str(datetime.now() + timedelta(hours=1))
|
||||
session['user_details'] = {"email": user.email_address, "id": user.id}
|
||||
return redirect('/verify')
|
||||
return redirect(url_for('main.verify'))
|
||||
|
||||
return render_template('views/register.html', form=form)
|
||||
|
||||
Reference in New Issue
Block a user