mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
Sources Sync
This commit is contained in:
parent
728db506af
commit
3e2d1b15db
2 changed files with 37 additions and 37 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 9c8bead8fa7a115a16192c7ef6a0f371af622d65
|
Subproject commit 694cf21806c396a97732aeb49a8f4b2784a1bb8c
|
|
@ -142,6 +142,35 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
login = params[Subscriber.EMAIL_FIELD]
|
login = params[Subscriber.EMAIL_FIELD]
|
||||||
password_hash = params[Subscriber.PASSWORD_FIELD]
|
password_hash = params[Subscriber.PASSWORD_FIELD]
|
||||||
|
|
||||||
|
check_user = Subscriber.objects(email=login, class_check=False).first()
|
||||||
|
if not check_user:
|
||||||
|
client.activate_device_fail(cid, 'User not found')
|
||||||
|
return False
|
||||||
|
|
||||||
|
if check_user.status == Subscriber.Status.NOT_ACTIVE:
|
||||||
|
client.activate_device_fail(cid, 'User not active')
|
||||||
|
return False
|
||||||
|
|
||||||
|
if check_user.status == Subscriber.Status.BANNED:
|
||||||
|
client.activate_device_fail(cid, 'Banned user')
|
||||||
|
return False
|
||||||
|
|
||||||
|
if check_user[Subscriber.PASSWORD_FIELD] != password_hash:
|
||||||
|
client.activate_device_fail(cid, 'User invalid password')
|
||||||
|
return False
|
||||||
|
|
||||||
|
result = client.activate_device_success(cid, check_user.get_devices())
|
||||||
|
if not result:
|
||||||
|
return False
|
||||||
|
client.info = check_user
|
||||||
|
self.__activate_subscriber(client)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _handle_login(self, client, cid: str, params: dict) -> bool:
|
||||||
|
login = params[Subscriber.EMAIL_FIELD]
|
||||||
|
password_hash = params[Subscriber.PASSWORD_FIELD]
|
||||||
|
device_id = params['device_id']
|
||||||
|
|
||||||
check_user = Subscriber.objects(email=login, class_check=False).first()
|
check_user = Subscriber.objects(email=login, class_check=False).first()
|
||||||
if not check_user:
|
if not check_user:
|
||||||
client.login_fail(cid, 'User not found')
|
client.login_fail(cid, 'User not found')
|
||||||
|
@ -159,47 +188,18 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
client.login_fail(cid, 'User invalid password')
|
client.login_fail(cid, 'User invalid password')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
result = client.login_success(cid, )
|
|
||||||
if not result:
|
|
||||||
return False
|
|
||||||
client.info = check_user
|
|
||||||
self.__activate_subscriber(client)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _handle_login(self, client, cid: str, params: dict) -> bool:
|
|
||||||
login = params[Subscriber.EMAIL_FIELD]
|
|
||||||
password_hash = params[Subscriber.PASSWORD_FIELD]
|
|
||||||
device_id = params['device_id']
|
|
||||||
|
|
||||||
check_user = Subscriber.objects(email=login, class_check=False).first()
|
|
||||||
if not check_user:
|
|
||||||
client.activate_fail(cid, 'User not found')
|
|
||||||
return False
|
|
||||||
|
|
||||||
if check_user.status == Subscriber.Status.NOT_ACTIVE:
|
|
||||||
client.activate_fail(cid, 'User not active')
|
|
||||||
return False
|
|
||||||
|
|
||||||
if check_user.status == Subscriber.Status.BANNED:
|
|
||||||
client.activate_fail(cid, 'Banned user')
|
|
||||||
return False
|
|
||||||
|
|
||||||
if check_user[Subscriber.PASSWORD_FIELD] != password_hash:
|
|
||||||
client.activate_fail(cid, 'User invalid password')
|
|
||||||
return False
|
|
||||||
|
|
||||||
found_device = check_user.find_device(device_id)
|
found_device = check_user.find_device(device_id)
|
||||||
if not found_device:
|
if not found_device:
|
||||||
client.activate_fail(cid, 'Device not found')
|
client.login_fail(cid, 'Device not found')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
user_connections = self.get_user_connections_by_email(login)
|
user_connections = self.get_user_connections_by_email(login)
|
||||||
for conn in user_connections:
|
for conn in user_connections:
|
||||||
if conn.device == found_device:
|
if conn.device == found_device:
|
||||||
client.activate_fail(cid, 'Device in use')
|
client.login_fail(cid, 'Device in use')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
result = client.activate_success(cid)
|
result = client.login_success(cid)
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
client.info = check_user
|
client.info = check_user
|
||||||
|
@ -209,7 +209,7 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
|
|
||||||
def _handle_get_server_info(self, client, cid: str, params: dict) -> bool:
|
def _handle_get_server_info(self, client, cid: str, params: dict) -> bool:
|
||||||
if not check_is_auth_client(client):
|
if not check_is_auth_client(client):
|
||||||
client.check_activate_fail(cid, 'User not active')
|
client.check_login_fail(cid, 'User not active')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return client.get_server_info_success(cid,
|
return client.get_server_info_success(cid,
|
||||||
|
@ -217,14 +217,14 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
|
|
||||||
def _handle_client_ping(self, client, cid: str, params: dict) -> bool:
|
def _handle_client_ping(self, client, cid: str, params: dict) -> bool:
|
||||||
if not check_is_auth_client(client):
|
if not check_is_auth_client(client):
|
||||||
client.check_activate_fail(cid, 'User not active')
|
client.check_login_fail(cid, 'User not active')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return client.pong(cid)
|
return client.pong(cid)
|
||||||
|
|
||||||
def _handle_get_channels(self, client, cid: str, params: dict) -> bool:
|
def _handle_get_channels(self, client, cid: str, params: dict) -> bool:
|
||||||
if not check_is_auth_client(client):
|
if not check_is_auth_client(client):
|
||||||
client.check_activate_fail(cid, 'User not active')
|
client.check_login_fail(cid, 'User not active')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
channels = client.info.get_streams()
|
channels = client.info.get_streams()
|
||||||
|
@ -232,7 +232,7 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
|
|
||||||
def _handle_get_runtime_channel_info(self, client, cid: str, params: dict) -> bool:
|
def _handle_get_runtime_channel_info(self, client, cid: str, params: dict) -> bool:
|
||||||
if not check_is_auth_client(client):
|
if not check_is_auth_client(client):
|
||||||
client.check_activate_fail(cid, 'User not active')
|
client.check_login_fail(cid, 'User not active')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sid = params['id']
|
sid = params['id']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue