mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 16:48:31 -04:00
Cleaning up a lot of things, getting Enums used everywhere.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -33,7 +33,7 @@ from app.dao.users_dao import (
|
||||
use_user_code,
|
||||
)
|
||||
from app.errors import InvalidRequest, register_errors
|
||||
from app.models import EMAIL_TYPE, KEY_TYPE_NORMAL, SMS_TYPE, Permission, Service
|
||||
from app.models import KEY_TYPE_NORMAL, Notification, NotificationType, Permission, Service, TemplateType
|
||||
from app.notifications.process_notifications import (
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
@@ -276,10 +276,10 @@ def send_user_2fa_code(user_id, code_type):
|
||||
)
|
||||
else:
|
||||
data = request.get_json()
|
||||
if code_type == SMS_TYPE:
|
||||
if NotificationType(code_type) == NotificationType.SMS:
|
||||
validate(data, post_send_user_sms_code_schema)
|
||||
send_user_sms_code(user_to_send_to, data)
|
||||
elif code_type == EMAIL_TYPE:
|
||||
elif NotificationType(code_type) == NotificationType.EMAIL:
|
||||
validate(data, post_send_user_email_code_schema)
|
||||
send_user_email_code(user_to_send_to, data)
|
||||
else:
|
||||
@@ -334,9 +334,9 @@ def create_2fa_code(
|
||||
# save the code in the VerifyCode table
|
||||
create_user_code(user_to_send_to, secret_code, template.template_type)
|
||||
reply_to = None
|
||||
if template.template_type == SMS_TYPE:
|
||||
if template.template_type == TemplateType.SMS:
|
||||
reply_to = get_sms_reply_to_for_notify_service(recipient, template)
|
||||
elif template.template_type == EMAIL_TYPE:
|
||||
elif template.template_type == TemplateType.EMAIL:
|
||||
reply_to = template.service.get_default_reply_to_email_address()
|
||||
|
||||
saved_notification = persist_notification(
|
||||
|
||||
Reference in New Issue
Block a user