diff --git a/ad2web/decoder.py b/ad2web/decoder.py index 3412d9d..db70832 100644 --- a/ad2web/decoder.py +++ b/ad2web/decoder.py @@ -23,6 +23,7 @@ from sqlalchemy.orm.exc import NoResultFound from flask import Blueprint, Response, request, g, current_app +from flask_login import current_user import jsonpickle from OpenSSL import SSL @@ -821,12 +822,12 @@ def recv_connect(self): session_interface = self._alarmdecoder.app.session_interface session = session_interface.open_session(self._alarmdecoder.app, self._request) - user_id = session.get('user_id', None) + user_id = session.get('_user_id', None) # check setup complete setup_stage = Setting.get_by_name('setup_stage').value - if (setup_stage and setup_stage != SETUP_COMPLETE) or user_id: + if (setup_stage and setup_stage != SETUP_COMPLETE) or user_is_authenticated(current_user): self.add_acl_method('on_keypress') self.add_acl_method('on_firmwareupload') self.add_acl_method('on_test') diff --git a/ad2web/notifications/types.py b/ad2web/notifications/types.py index 6d6be62..232b653 100644 --- a/ad2web/notifications/types.py +++ b/ad2web/notifications/types.py @@ -1141,7 +1141,7 @@ def _do_post(self, data, app=None): return True else: app.logger.info('Event Custom Notification Failed') - raise Exception('Custom Notification Failed (' + str(http_response.status) + ") " + http_response.reason) + raise Exception('Custom Notification Failed (' + str(http_response.status) + ") " + http_response.reason + " Headers:" + str(self.headers) + " Body:" + str(data)) # Warning: Threaded so it may be sent later and state may change. # Never access any AD2* state vars in a threaded function. @@ -1175,6 +1175,8 @@ def _do_get(self, data, app=None): @raise_with_stack def send(self, type, text, raw): self.msg_to_send = text + message_string = 'Primary Residence Alarm Event: %s' % text + json_data = {"text": message_string} result = False if check_time_restriction(self.starttime, self.endtime): @@ -1211,7 +1213,7 @@ def send(self, type, text, raw): result = self._do_post(self._dict_to_xml('notification', notify_data)) if self.post_type == JSON: - result = self._do_post(self._dict_to_json(notify_data) ) + result = self._do_post(self._dict_to_json(json_data)) if self.method == CUSTOM_METHOD_GET_TYPE: if self.post_type == URLENCODE: diff --git a/requirements.txt b/requirements.txt index a95d569..df28901 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,55 +1,56 @@ -Babel>=1.3 -Flask>=1.0.0.0 -Flask-Babel>=0.9 -flask-caching>=1.7.2 -Flask-Login>=0.2.10 -Flask-Mail>=0.9.0 -Flask-OpenID>=1.2.1 -Flask-SQLAlchemy>=1.0 -Flask-Script>=0.6.7 -Flask-Testing>=0.4.1 -Flask-WTF>=0.9.4 -Jinja2>=2.7.2 -Mako>=0.9.1 -MarkupSafe>=0.19 -Pygments>=1.6 -SQLAlchemy>=0.9.3 -Sphinx>=1.2.2,<2 -WTForms>=1.0.5 -Werkzeug>=0.9.4 -alarmdecoder>=1.13.4 -alembic>=0.6.4 +Babel==2.9.1 +Flask==1.1.4 +Flask-Babel==1.0.0 +Flask-Caching==1.7.2 +Flask-Login==0.5.0 +Flask-Mail==0.9.1 +Flask-OpenID==1.2.5 +Flask-SQLAlchemy==2.5.1 +Flask-Script==2.0.6 +Flask-Testing==0.8.1 +Flask-WTF==0.14.3 +Jinja2==2.11.3 +Mako>=1.0.7 +MarkupSafe==1.1.1 +Pygments==2.5.2 +SQLAlchemy==1.2.19 +Sphinx==1.8.6 +WTForms==2.2.1 +Werkzeug==0.16.1 +alarmdecoder>=1.13.12 +alembic==1.3.3 argparse>=1.2.1 -async>=0.6.1 -blinker>=1.3 -cffi>=0.8.2 -cryptography>=0.4 +async==0.6.2 +blinker==1.4 +cffi==1.15.1 +pyftdi==0.13.4 +cryptography==3.3.2 distribute>=0.6.24 -docutils>=0.11 +docutils==0.14 gevent==1.1b4 -gevent-socketio>=0.3.6 -gevent-websocket>=0.9.3 -gitdb>=0.5.4 -greenlet>=0.4.2 -itsdangerous>=0.23 -jsonpickle>=0.7.0 -mock>=1.0.1 -nose>=1.3.1 -psutil>=2.0.0 -pyOpenSSL>=0.14 -pycparser>=2.10 -python-openid>=2.2.5 -pytz>=2014.1 -sh>=1.09 -six>=1.6.1 -sleekxmpp>=1.2.4 -smmap>=0.8.2 +gevent-socketio==0.3.6 +gevent-websocket==0.10.1 +gitdb==0.6.4 +greenlet==0.4.15 +itsdangerous==1.1.0 +jsonpickle==0.9.5 +mock==3.0.5 +nose==1.3.7 +psutil==6.1.1 +pyOpenSSL==21.0.0 +pycparser==2.19 +python-openid==2.2.5 +pytz>=2025.1 +sh==1.14.3 +six==1.17.0 +sleekxmpp==1.3.3 +smmap==0.9.0 speaklater>=1.3 wsgiref>=0.1.2 -netifaces>=0.10.4 +netifaces==0.10.4 futures; python_version=="2.7" -numpy>=1.9.2 -chump>=1.5.1 -twilio>=6.8.2 -gntp>=1.0.2 -miniupnpc>=1.9 +numpy==1.16.2 +chump==1.6.0 +twilio==6.63.2 +gntp==1.0.3 +miniupnpc==2.0.2