mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
109526036: Updates as per comments made on pull request.
This commit is contained in:
@@ -25,7 +25,7 @@ def get_code_by_code(user_id, code_type):
|
||||
|
||||
|
||||
def use_code(id):
|
||||
verify_code = VerifyCodes.query.filter_by(id=id).first()
|
||||
verify_code = VerifyCodes.query.get(id)
|
||||
verify_code.code_used = True
|
||||
db.session.add(verify_code)
|
||||
db.session.commit()
|
||||
|
||||
@@ -5,6 +5,6 @@ def hashpw(password):
|
||||
return generate_password_hash(password.encode('UTF-8'), 10)
|
||||
|
||||
|
||||
def checkpw(password, hashed_password):
|
||||
def check_hash(password, hashed_password):
|
||||
# If salt is invalid throws a 500 should add try/catch here
|
||||
return check_password_hash(hashed_password, password)
|
||||
|
||||
@@ -6,7 +6,7 @@ from wtforms import StringField, PasswordField
|
||||
from wtforms.validators import DataRequired, Email, Length, Regexp
|
||||
|
||||
from app.main.dao import verify_codes_dao
|
||||
from app.main.encryption import checkpw
|
||||
from app.main.encryption import check_hash
|
||||
from app.main.validators import Blacklist
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ def validate_code(field, code):
|
||||
field.errors.append('Code has expired')
|
||||
return False
|
||||
if field.data is not None:
|
||||
if checkpw(field.data, code.code) is False:
|
||||
if check_hash(field.data, code.code) is False:
|
||||
field.errors.append('Code does not match')
|
||||
return False
|
||||
else:
|
||||
|
||||
@@ -3,7 +3,7 @@ from flask import session
|
||||
|
||||
from app.main import main
|
||||
from app.main.dao import users_dao
|
||||
from app.main.encryption import checkpw
|
||||
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
|
||||
@@ -25,7 +25,7 @@ def process_sign_in():
|
||||
return jsonify(locked_out=True), 401
|
||||
if not user.is_active():
|
||||
return jsonify(active_user=False), 401
|
||||
if checkpw(form.password.data, user.password):
|
||||
if check_hash(form.password.data, user.password):
|
||||
sms_code = send_sms_code(user.id, user.mobile_number)
|
||||
session['user_id'] = user.id
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user