mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-12-23 13:22:17 +03:00
userın kendi ip si eklendi..
This commit is contained in:
parent
43961a436f
commit
e41d771ed4
3 changed files with 5 additions and 2 deletions
|
@ -47,6 +47,7 @@ class Commander(object):
|
|||
if len(params) == 6:
|
||||
data['ip'] = params[5]
|
||||
|
||||
|
||||
elif len(params) == 3 and params[1] == 'logout':
|
||||
print('{0} logging out'.format(str(params[2])))
|
||||
data['event'] = params[1]
|
||||
|
|
|
@ -61,12 +61,13 @@ class CommandRunner(object):
|
|||
display = json_data['display']
|
||||
desktop = json_data['desktop']
|
||||
|
||||
|
||||
ip = None
|
||||
if 'ip' in json_data:
|
||||
ip = json_data['ip']
|
||||
|
||||
self.logger.info('login event is handled for user: {0}'.format(username))
|
||||
login_message = self.message_manager.login_msg(username)
|
||||
login_message = self.message_manager.login_msg(username,ip)
|
||||
self.messenger.send_direct_message(login_message)
|
||||
|
||||
agreement = Agreement()
|
||||
|
|
|
@ -64,12 +64,13 @@ class Messaging(object):
|
|||
self.logger.debug('Policy status message was created')
|
||||
return str(json_data)
|
||||
|
||||
def login_msg(self, username):
|
||||
def login_msg(self, username,ip=None):
|
||||
data = dict()
|
||||
data['type'] = 'LOGIN'
|
||||
data['username'] = username
|
||||
data['ipAddresses'] = str(System.Hardware.Network.ip_addresses()).replace('[', '').replace(']', '')
|
||||
data['timestamp'] = Util.timestamp()
|
||||
data['userIp'] = ip
|
||||
|
||||
data['hardware.monitors'] = str(System.Hardware.monitors()),
|
||||
data['hardware.screens'] = str(System.Hardware.screens()),
|
||||
|
|
Loading…
Reference in a new issue