mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 20:32:20 +03:00
login checker added
This commit is contained in:
parent
2884993ebc
commit
da38e95635
1 changed files with 10 additions and 3 deletions
|
@ -26,6 +26,13 @@ class CommandRunner(object):
|
||||||
self.db_service = scope.get_db_service()
|
self.db_service = scope.get_db_service()
|
||||||
self.execute_manager = scope.get_execution_manager()
|
self.execute_manager = scope.get_execution_manager()
|
||||||
|
|
||||||
|
def check_last_login(self):
|
||||||
|
last_login_tmstmp=self.db_service.select_one_result('session', 'timestamp')
|
||||||
|
if (int(time.time())-int(last_login_tmstmp))<10:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def run_command_from_fifo(self, num, stack):
|
def run_command_from_fifo(self, num, stack):
|
||||||
""" docstring"""
|
""" docstring"""
|
||||||
|
|
||||||
|
@ -46,7 +53,7 @@ class CommandRunner(object):
|
||||||
self.logger.debug('Signal handled')
|
self.logger.debug('Signal handled')
|
||||||
self.logger.debug('Signal is :{0}'.format(str(json_data['event'])))
|
self.logger.debug('Signal is :{0}'.format(str(json_data['event'])))
|
||||||
|
|
||||||
if str(json_data['event']) == 'login':
|
if str(json_data['event']) == 'login' and self.check_last_login():
|
||||||
username = json_data['username']
|
username = json_data['username']
|
||||||
display = json_data['display']
|
display = json_data['display']
|
||||||
desktop = json_data['desktop']
|
desktop = json_data['desktop']
|
||||||
|
@ -103,7 +110,7 @@ class CommandRunner(object):
|
||||||
username))
|
username))
|
||||||
session_columns = self.db_service.get_cols('session')
|
session_columns = self.db_service.get_cols('session')
|
||||||
self.db_service.update('session', session_columns,
|
self.db_service.update('session', session_columns,
|
||||||
[username, display, desktop, Util.timestamp()])
|
[username, display, desktop, str(int(time.time()))])
|
||||||
get_policy_message = self.message_manager.policy_request_msg(username)
|
get_policy_message = self.message_manager.policy_request_msg(username)
|
||||||
|
|
||||||
self.plugin_manager.process_mode('safe', username)
|
self.plugin_manager.process_mode('safe', username)
|
||||||
|
|
Loading…
Reference in a new issue