diff --git a/VERSION b/VERSION index b0a1227..58682af 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.10 \ No newline at end of file +0.0.11 \ No newline at end of file diff --git a/src/flask_graylog_bundle/auth.py b/src/flask_graylog_bundle/auth.py index 2bdf51b..09e3be5 100644 --- a/src/flask_graylog_bundle/auth.py +++ b/src/flask_graylog_bundle/auth.py @@ -6,6 +6,7 @@ """ +import logging import re from flask import g, request @@ -15,6 +16,8 @@ from flask_graylog_bundle import GraylogExt, MESSAGE_MAP +logger = logging.getLogger(__name__) + class GraylogAuth(GraylogExt): def login_required(self, func): @@ -47,9 +50,10 @@ def username(self): @staticmethod def authenticate(): """Sends a 401 response""" + logger.error(MESSAGE_MAP["AuthenticationFailed"]) raise Unauthorized( message=MESSAGE_MAP["AuthenticationFailed"], - extra=dict(factory="graylog-auth", msgid="AuthenticationFailed") + extra=dict(msgid="AuthenticationFailed") ) def load_user_info(self): diff --git a/src/flask_graylog_bundle/server.py b/src/flask_graylog_bundle/server.py index 337b0ee..776ac53 100644 --- a/src/flask_graylog_bundle/server.py +++ b/src/flask_graylog_bundle/server.py @@ -6,11 +6,13 @@ """ +import logging from cdumay_rest_client.exceptions import NotFound, ValidationError from flask_graylog_bundle import GraylogExt, MESSAGE_MAP from cdumay_rest_client.client import RESTClient from flask_graylog_bundle import validators +logger = logging.getLogger(__name__) class GraylogAPIServer(GraylogExt): @@ -91,9 +93,10 @@ def user_is_admin(self, username): def user_set_password(self, username, password): if password in ("", None): + logger.error(MESSAGE_MAP["PasswordNull"]) raise ValidationError( message=MESSAGE_MAP["PasswordNull"], - extra=dict(factory="graylog-auth", msgid="PasswordNull") + extra=dict(msgid="PasswordNull") ) return self._update( spath=['users', username, 'password'],