mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Small comments.
This commit is contained in:
@@ -11,21 +11,17 @@ from app.main.views import send_sms_code
|
|||||||
|
|
||||||
@main.route('/sign-in', methods=(['GET', 'POST']))
|
@main.route('/sign-in', methods=(['GET', 'POST']))
|
||||||
def sign_in():
|
def sign_in():
|
||||||
try:
|
form = LoginForm()
|
||||||
form = LoginForm()
|
if form.validate_on_submit():
|
||||||
if form.validate_on_submit():
|
user = users_dao.get_user_by_email(form.email_address.data)
|
||||||
user = users_dao.get_user_by_email(form.email_address.data)
|
if user:
|
||||||
if user:
|
if not user.is_locked() and user.is_active() and check_hash(form.password.data, user.password):
|
||||||
if not user.is_locked() and user.is_active() and check_hash(form.password.data, user.password):
|
send_sms_code(user.id, user.mobile_number)
|
||||||
send_sms_code(user.id, user.mobile_number)
|
session['user_id'] = user.id
|
||||||
session['user_id'] = user.id
|
return redirect(url_for('.two_factor'))
|
||||||
return redirect(url_for('.two_factor'))
|
else:
|
||||||
else:
|
users_dao.increment_failed_login_count(user.id)
|
||||||
users_dao.increment_failed_login_count(user.id)
|
# Vague error message for login
|
||||||
# Vague error message for login
|
form.password.errors.append('Username or password is incorrect')
|
||||||
form.password.errors.append('Username or password is incorrect')
|
|
||||||
|
|
||||||
return render_template('views/signin.html', form=form)
|
return render_template('views/signin.html', form=form)
|
||||||
except:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from flask_login import login_required
|
|||||||
|
|
||||||
from app.main import main
|
from app.main import main
|
||||||
|
|
||||||
|
# TODO move this to the templates directory
|
||||||
message_templates = [
|
message_templates = [
|
||||||
{
|
{
|
||||||
'name': 'Reminder',
|
'name': 'Reminder',
|
||||||
|
|||||||
Reference in New Issue
Block a user