add MMDVM server to auth log
This commit is contained in:
parent
5f57ceae66
commit
ea39d5fa6a
@ -951,6 +951,9 @@ def create_app():
|
||||
elif request.args.get('flush_user_db') == 'true' and request.args.get('portal_username'):
|
||||
content = '''<p style="text-align: center;"><strong>Flushed auth DB for: ''' + request.args.get('portal_username') + '''</strong></strong></p>\n'''
|
||||
authlog_flush_user(request.args.get('portal_username'))
|
||||
elif request.args.get('flush_user_mmdvm') == 'true' and request.args.get('mmdvm_server'):
|
||||
content = '''<p style="text-align: center;"><strong>Flushed auth DB for: ''' + request.args.get('mmdvm_server') + '''</strong></strong></p>\n'''
|
||||
authlog_flush_mmdvm_server(request.args.get('mmdvm_server'))
|
||||
elif request.args.get('flush_dmr_id_db') == 'true' and request.args.get('dmr_id'):
|
||||
content = '''<p style="text-align: center;"><strong>Flushed auth DB for: ''' + request.args.get('dmr_id') + '''</strong></strong></p>\n'''
|
||||
authlog_flush_dmr_id(request.args.get('dmr_id'))
|
||||
@ -1003,7 +1006,80 @@ def create_app():
|
||||
if i.login_type == 'Attempt':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong>''' + str(i.login_dmr_id) + '''</strong> </td>
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> <a href="edit_user?callsign=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"> <span style="color: #000000; background-color: #ffff00;"><strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
'''
|
||||
if i.login_type == 'Confirmed':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> <a href="edit_user?callsign=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"> <span style="color: #000000; background-color: #00ff00;"><strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
'''
|
||||
if i.login_type == 'Failed':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.portal_username + ''' </a></td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"><span style="color: #000000; background-color: #FF2400;"> <strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
'''
|
||||
content = content + '</tbody></table>'
|
||||
|
||||
elif request.args.get('mmdvm_server'):
|
||||
print('mmdvm')
|
||||
a = AuthLog.query.filter_by(server_name=request.args.get('mmdvm_server')).order_by(AuthLog.login_time.desc()).all()
|
||||
content = '''
|
||||
<p> </p>
|
||||
<p style="text-align: center;"><strong><a href="auth_log?flush_db_mmdvm=true&mmdvm_server=''' + request.args.get('mmdvm_server') + '''">Flush authentication log for server: ''' + request.args.get('mmdvm_server') + '''</a></strong></p>
|
||||
<p style="text-align: center;"><strong>Log for MMDVM server: ''' + request.args.get('mmdvm_server') + '''</strong></p>
|
||||
|
||||
|
||||
<table style="width: 1000px; margin-left: auto; margin-right: auto;" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<h4> DMR ID </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Portal Username </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Login IP </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Calculated Passphrase </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Server </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Time (UTC) </h4>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h4> Login Status </h4>
|
||||
</td>
|
||||
</tr> \n'''
|
||||
for i in a:
|
||||
if i.login_type == 'Attempt':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> <a href="edit_user?callsign=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
@ -1015,7 +1091,7 @@ def create_app():
|
||||
if i.login_type == 'Confirmed':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong>''' + str(i.login_dmr_id) + '''</strong> </td>
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> <a href="edit_user?callsign=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
@ -1027,7 +1103,7 @@ def create_app():
|
||||
if i.login_type == 'Failed':
|
||||
content = content + '''
|
||||
<tr >
|
||||
<td style="text-align: center;"> <strong>''' + str(i.login_dmr_id) + '''</strong> </td>
|
||||
<td style="text-align: center;"> <strong><a href="auth_log?dmr_id=''' + str(i.login_dmr_id) + '''">''' + str(i.login_dmr_id) + '''</a></strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.portal_username + ''' </a></td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
@ -1037,6 +1113,7 @@ def create_app():
|
||||
</tr>
|
||||
'''
|
||||
content = content + '</tbody></table>'
|
||||
|
||||
else:
|
||||
#a = AuthLog.query.all().order_by(AuthLog.login_dmr_id)
|
||||
#a = AuthLog.query.all()
|
||||
@ -1045,8 +1122,7 @@ def create_app():
|
||||
## r = AuthLog.query.order_by(AuthLog.login_dmr_id.desc()).all()
|
||||
content = '''
|
||||
<p> </p>
|
||||
<p style="text-align: center;"><strong><a href="auth_log?flush_db=true">Flush entire auth log</a></strong></p>
|
||||
<p> </p>
|
||||
<p style="text-align: center;"><strong><a href="auth_log?flush_db=true">Flush entire authentication log</a></strong></p>
|
||||
<p style="text-align: center;"><strong>Auth log by DMR ID</strong></p>
|
||||
|
||||
<table style="width: 1000px; margin-left: auto; margin-right: auto;" border="1">
|
||||
@ -1084,7 +1160,7 @@ def create_app():
|
||||
<td style="text-align: center;"> <a href="auth_log?portal_username=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> ''' + i.server_name + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"> <span style="color: #000000; background-color: #ffff00;"><strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
@ -1096,7 +1172,7 @@ def create_app():
|
||||
<td style="text-align: center;"> <a href="auth_log?portal_username=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> ''' + i.server_name + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"> <span style="color: #000000; background-color: #00ff00;"><strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
@ -1108,7 +1184,7 @@ def create_app():
|
||||
<td style="text-align: center;"> <a href="auth_log?portal_username=''' + i.portal_username + '''">''' + i.portal_username + '''</a> </a></td>
|
||||
<td style="text-align: center;"> <strong>''' + i.peer_ip + '''</strong> </td>
|
||||
<td style="text-align: center;"> ''' + i.login_auth_method + ''' </td>
|
||||
<td style="text-align: center;"> ''' + i.server_name + ''' </td>
|
||||
<td style="text-align: center;"> <a href="auth_log?mmdvm_server=''' + str(i.server_name) + '''">''' + str(i.server_name) + '''</a> </td>
|
||||
<td style="text-align: center;"> ''' + str(i.login_time) + ''' </td>
|
||||
<td style="text-align: center;"><span style="color: #000000; background-color: #FF2400;"> <strong>''' + str(i.login_type) + '''</span></strong> </td>
|
||||
</tr>
|
||||
@ -1281,6 +1357,11 @@ def create_app():
|
||||
for i in flush_e:
|
||||
db.session.delete(i)
|
||||
db.session.commit()
|
||||
def authlog_flush_mmdvm_server(_mmdvm_serv):
|
||||
flush_e = AuthLog.query.filter_by(server_name=_mmdvm_serv).all()
|
||||
for i in flush_e:
|
||||
db.session.delete(i)
|
||||
db.session.commit()
|
||||
|
||||
@app.route('/add_user', methods=['POST', 'GET'])
|
||||
@login_required
|
||||
|
Loading…
Reference in New Issue
Block a user