summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/auth.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-06-23 12:19:39 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2017-06-23 12:19:39 +0100
commit0cc0882ac90fb32ea75b2628abe38734015b06fc (patch)
tree5137728eab1632d45051309bbbe682d8084a9aea /deluge/ui/web/auth.py
parenta7c4228ce79bdd7b8658322173430773c06bbc24 (diff)
downloaddeluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.tar.gz
deluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.tar.bz2
deluge-0cc0882ac90fb32ea75b2628abe38734015b06fc.zip
[WebUI] Refactor out AuthError for NotAuthorizedError
Diffstat (limited to 'deluge/ui/web/auth.py')
-rw-r--r--deluge/ui/web/auth.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py
index 0a2ad0ac3..5416b677d 100644
--- a/deluge/ui/web/auth.py
+++ b/deluge/ui/web/auth.py
@@ -19,21 +19,12 @@ from email.utils import formatdate
from twisted.internet.task import LoopingCall
from deluge.common import AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE
+from deluge.error import NotAuthorizedError
+from deluge.ui.web.json_api import JSONComponent, export
log = logging.getLogger(__name__)
-class AuthError(Exception):
- """
- An exception that might be raised when checking a request for
- authentication.
- """
- pass
-
-# Import after as json_api imports the above AuthError
-from deluge.ui.web.json_api import export, JSONComponent # NOQA, isort:skip pylint: disable=wrong-import-position
-
-
def make_checksum(session_id):
checksum = 0
for value in [ord(char) for char in session_id]:
@@ -226,7 +217,7 @@ class Auth(JSONComponent):
request.session_id = session_id
if auth_level < level:
- raise AuthError('Not authenticated')
+ raise NotAuthorizedError(auth_level, level)
def _change_password(self, new_password):
"""