109898688: Implement get method for email-not-received and text-not-received

This commit is contained in:
Rebecca Law
2015-12-15 11:06:09 +00:00
parent cbd47fe2ce
commit e9383b733e
5 changed files with 43 additions and 13 deletions

View File

@@ -3,4 +3,4 @@ from flask import Blueprint
main = Blueprint('main', __name__)
from app.main.views import index, sign_in, register, two_factor, verify, sms, add_service
from app.main.views import index, sign_in, register, two_factor, verify, sms, add_service, code_not_received

View File

@@ -0,0 +1,23 @@
from flask import render_template
from app.main import main
@main.route("/email-not-received", methods=['GET'])
def email_not_received():
return render_template('views/email-not-received.html')
@main.route('/email-not-received', methods=['POST'])
def check_and_resend_email_code():
return None
@main.route("/text-not-received", methods=['GET'])
def text_not_received():
return render_template('views/text-not-received.html')
@main.route('/text-not-received', methods=['POST'])
def check_and_resend_text_code():
return None

View File

@@ -35,16 +35,6 @@ def dashboard():
return render_template('views/dashboard.html')
@main.route("/email-not-received")
def emailnotreceived():
return render_template('views/email-not-received.html')
@main.route("/text-not-received")
def textnotreceived():
return render_template('views/text-not-received.html')
@main.route("/send-email")
def sendemail():
return render_template('views/send-email.html')

View File

@@ -4,7 +4,6 @@ from flask import session
from app.main import main
from app.main.dao import users_dao
from app.main.encryption import check_hash
from app.main.encryption import hashpw
from app.main.forms import LoginForm
from app.main.views import send_sms_code
@@ -26,7 +25,7 @@ def process_sign_in():
if not user.is_active():
return jsonify(active_user=False), 401
if check_hash(form.password.data, user.password):
sms_code = send_sms_code(user.id, user.mobile_number)
send_sms_code(user.id, user.mobile_number)
session['user_id'] = user.id
else:
users_dao.increment_failed_login_count(user.id)