mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 17:38:25 -04:00
Work in progress.
This commit is contained in:
@@ -61,8 +61,10 @@ class UKMobileNumber(StringField):
|
|||||||
|
|
||||||
if len(self.data) != 9:
|
if len(self.data) != 9:
|
||||||
return
|
return
|
||||||
|
# TODO implement in the render field method.
|
||||||
self.data = '+44 7{} {} {}'.format(*re.findall('...', self.data))
|
# API's require no spaces in the number
|
||||||
|
#self.data = '+44 7{} {} {}'.format(*re.findall('...', self.data))
|
||||||
|
self.data = '+447{}{}{}'.format(*re.findall('...', self.data))
|
||||||
|
|
||||||
|
|
||||||
def mobile_number():
|
def mobile_number():
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def add_service():
|
|||||||
heading = 'Add a new service'
|
heading = 'Add a new service'
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
user = users_dao.get_user_by_id(session['user_id'])
|
user = users_dao.get_user_by_id(session['user_id'])
|
||||||
service_id = services_dao.insert_new_service(form.name.data, user)
|
service_id = services_dao.insert_new_service(form.name.data, user.id)
|
||||||
return redirect(url_for('main.service_dashboard', service_id=service_id))
|
return redirect(url_for('main.service_dashboard', service_id=service_id))
|
||||||
else:
|
else:
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class NotificationsAdminAPIClient(NotificationsAPIClient):
|
|||||||
|
|
||||||
def init_app(self, application):
|
def init_app(self, application):
|
||||||
self.base_url = application.config['API_HOST_NAME']
|
self.base_url = application.config['API_HOST_NAME']
|
||||||
self.client_id = application.config['NOTIFY_API_CLIENT']
|
self.client_id = application.config['ADMIN_CLIENT_USER_NAME']
|
||||||
self.secret = application.config['NOTIFY_API_SECRET']
|
self.secret = application.config['ADMIN_CLIENT_SECRET']
|
||||||
|
|
||||||
def create_service(self, service_name, active, limit, restricted, user_id):
|
def create_service(self, service_name, active, limit, restricted, user_id):
|
||||||
"""
|
"""
|
||||||
@@ -128,6 +128,8 @@ class NotificationsAdminAPIClient(NotificationsAPIClient):
|
|||||||
message,
|
message,
|
||||||
job_id=None,
|
job_id=None,
|
||||||
description=None):
|
description=None):
|
||||||
|
print("{0} {1} {2} {3}".format(
|
||||||
|
mobile_number, message, job_id, description))
|
||||||
self.send_sms_notification(mobile_number, message)
|
self.send_sms_notification(mobile_number, message)
|
||||||
|
|
||||||
def send_email(self,
|
def send_email(self,
|
||||||
@@ -137,4 +139,5 @@ class NotificationsAdminAPIClient(NotificationsAPIClient):
|
|||||||
subject,
|
subject,
|
||||||
job_id=None,
|
job_id=None,
|
||||||
description=None):
|
description=None):
|
||||||
pass
|
print("{0} {1} {2} {3} {4} {5}".format(
|
||||||
|
email_address, message, from_address, subject, job_id, description))
|
||||||
|
|||||||
Reference in New Issue
Block a user