Skip to content

Commit

Permalink
Refs #253 Updated base implementation with exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
doumdi committed Sep 16, 2024
1 parent 7009500 commit 73eb372
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
11 changes: 4 additions & 7 deletions teraserver/python/modules/FlaskModule/API/user/UserLogin2FA.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from modules.FlaskModule.FlaskModule import user_api_ns as api
from modules.FlaskModule.API.user.UserLoginBase import UserLoginBase
from modules.FlaskModule.API.user.UserLoginBase import OutdatedClientVersionError, InvalidClientVersionError, \
InvalidClientVersionHandlerError, UserAlreadyLoggedInError
UserAlreadyLoggedInError
from werkzeug.exceptions import BadRequest
from opentera.redis.RedisRPCClient import RedisRPCClient
from opentera.modules.BaseModule import ModuleNames
Expand Down Expand Up @@ -77,12 +77,9 @@ def get(self):
'current_version': e.current_version,
'version_error': e.version_error,
'message': gettext('Client major version too old, not accepting login')}, 426
except InvalidClientVersionError as e:
# Invalid client version, will not be handled for now
pass
except InvalidClientVersionHandlerError as e:
self._user_logout()
return gettext('Invalid client version handler'), 500
# except InvalidClientVersionError as e:
# # Invalid client version, will not be handled for now
# pass
except UserAlreadyLoggedInError as e:
self._user_logout()
return gettext('User already logged in.'), 403
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ def __init__(self, message):
super().__init__(message)


class InvalidClientVersionHandlerError(Exception):
# Raised when the client version handler is invalid
def __init__(self, message):
super().__init__(message)


class UserAlreadyLoggedInError(Exception):
# Raised when the user is already logged in
def __init__(self, message):
Expand Down

0 comments on commit 73eb372

Please sign in to comment.