Merge pull request #682 from alphagov/resend-verification-code

Resend verification code
This commit is contained in:
Adam Shimali
2016-06-14 12:02:41 +01:00
committed by GitHub
3 changed files with 58 additions and 73 deletions

View File

@@ -22,20 +22,21 @@ def resend_email_verification():
def check_and_resend_text_code():
# TODO there needs to be a way to regenerate a session id
user = user_api_client.get_user_by_email(session['user_details']['email'])
if user.state == 'active':
# this is a verified user and therefore redirect to page to request resend without edit mobile
return render_template('views/verification-not-received.html')
form = TextNotReceivedForm(mobile_number=user.mobile_number)
if form.validate_on_submit():
user_api_client.send_verify_code(user.id, 'sms', to=form.mobile_number.data)
user.mobile_number = form.mobile_number.data
user_api_client.update_user(user)
return redirect(url_for('.verify'))
return render_template('views/text-not-received.html', form=form)
@main.route('/verification-not-received', methods=['GET'])
def verification_code_not_received():
return render_template('views/verification-not-received.html')
@main.route('/send-new-code', methods=['GET'])
def check_and_resend_verification_code():
# TODO there needs to be a way to generate a new session id

View File

@@ -23,7 +23,7 @@
) }}
{{ page_footer(
"Continue",
secondary_link=url_for('.verification_code_not_received'),
secondary_link=url_for('main.check_and_resend_text_code'),
secondary_link_text='Not received a text message?'
) }}
</form>