forked from shaba/openuds
Merge remote-tracking branch 'origin/v3.5' into v3.6
This commit is contained in:
commit
dd08257fb9
@ -46,6 +46,8 @@ from uds.core.util.config import GlobalConfig
|
|||||||
from uds.core.services.exceptions import ServiceNotReadyError
|
from uds.core.services.exceptions import ServiceNotReadyError
|
||||||
from uds.core import VERSION as UDS_VERSION
|
from uds.core import VERSION as UDS_VERSION
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
from uds.models import UserService
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -53,6 +55,7 @@ CLIENT_VERSION = UDS_VERSION
|
|||||||
REQUIRED_CLIENT_VERSION = '3.5.0'
|
REQUIRED_CLIENT_VERSION = '3.5.0'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Enclosed methods under /client path
|
# Enclosed methods under /client path
|
||||||
class Client(Handler):
|
class Client(Handler):
|
||||||
"""
|
"""
|
||||||
@ -122,6 +125,7 @@ class Client(Handler):
|
|||||||
if len(self._args) == 1: # Simple test
|
if len(self._args) == 1: # Simple test
|
||||||
return Client.result(_('Correct'))
|
return Client.result(_('Correct'))
|
||||||
|
|
||||||
|
userService: typing.Optional['UserService'] = None
|
||||||
try:
|
try:
|
||||||
(
|
(
|
||||||
ticket,
|
ticket,
|
||||||
@ -180,9 +184,6 @@ class Client(Handler):
|
|||||||
)
|
)
|
||||||
password = cryptoManager().symDecrpyt(data['password'], scrambler)
|
password = cryptoManager().symDecrpyt(data['password'], scrambler)
|
||||||
|
|
||||||
# Set "accesedByClient"
|
|
||||||
userService.setProperty('accessedByClient', '1')
|
|
||||||
|
|
||||||
# userService.setConnectionSource(srcIp, hostname) # Store where we are accessing from so we can notify Service
|
# userService.setConnectionSource(srcIp, hostname) # Store where we are accessing from so we can notify Service
|
||||||
if not ip:
|
if not ip:
|
||||||
raise ServiceNotReadyError()
|
raise ServiceNotReadyError()
|
||||||
@ -218,10 +219,6 @@ class Client(Handler):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
except ServiceNotReadyError as e:
|
except ServiceNotReadyError as e:
|
||||||
# Set that client has accesed userService
|
|
||||||
if e.userService:
|
|
||||||
e.userService.setProperty('accessedByClient', '1')
|
|
||||||
|
|
||||||
# Refresh ticket and make this retrayable
|
# Refresh ticket and make this retrayable
|
||||||
TicketStore.revalidate(
|
TicketStore.revalidate(
|
||||||
ticket, 20
|
ticket, 20
|
||||||
@ -232,3 +229,7 @@ class Client(Handler):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Exception")
|
logger.exception("Exception")
|
||||||
return Client.result(error=str(e))
|
return Client.result(error=str(e))
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if userService:
|
||||||
|
userService.setProperty('accessedByClient', '1')
|
||||||
|
Loading…
Reference in New Issue
Block a user