Use the exceptions from `deluge.errors`.
This commit is contained in:
parent
b2a16a0240
commit
67ff83360f
|
@ -40,7 +40,7 @@ import logging
|
|||
|
||||
import deluge.component as component
|
||||
import deluge.configmanager as configmanager
|
||||
import deluge.error
|
||||
from deluge.error import BadLoginError, AuthenticationRequired
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -51,12 +51,6 @@ AUTH_LEVEL_ADMIN = 10
|
|||
|
||||
AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL
|
||||
|
||||
class BadLoginError(deluge.error.DelugeError):
|
||||
pass
|
||||
|
||||
class PasswordRequired(BadLoginError):
|
||||
pass
|
||||
|
||||
class AuthManager(component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "AuthManager")
|
||||
|
@ -108,7 +102,7 @@ class AuthManager(component.Component):
|
|||
# Return the users auth level
|
||||
return auth_level
|
||||
elif not password and self.__auth[username][0]:
|
||||
raise PasswordRequired("Password is required")
|
||||
raise AuthenticationRequired("Password is required", username)
|
||||
else:
|
||||
raise BadLoginError("Password does not match")
|
||||
|
||||
|
|
Loading…
Reference in New Issue